*
*/
+#include "apatchgui.h"
+#include "autoconf.h"
+#include "autos.h"
+#include "bcwindowbase.h"
+#include "cpanel.h"
+#include "cwindowgui.h"
#include "cwindow.h"
#include "edl.h"
+#include "edlsession.h"
+#include "filexml.h"
+#include "gwindow.h"
+#include "gwindowgui.h"
#include "keyframe.h"
#include "keyframepopup.h"
#include "language.h"
+#include "localsession.h"
+#include "maincursor.h"
+#include "mainmenu.h"
#include "mainundo.h"
-#include "mwindow.h"
#include "mwindowgui.h"
-#include "localsession.h"
-#include "cwindowgui.h"
-#include "cpanel.h"
+#include "mwindow.h"
#include "patchbay.h"
#include "patchgui.h"
-#include "apatchgui.h"
-#include "vpatchgui.h"
#include "track.h"
-#include "maincursor.h"
-#include "bcwindowbase.h"
-#include "filexml.h"
-#include "edlsession.h"
-#include "autos.h"
+#include "vpatchgui.h"
KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui)
: BC_PopupMenu(0, 0, 0, "", 0)
}
+KeyframeHidePopup::KeyframeHidePopup(MWindow *mwindow, MWindowGUI *gui)
+ : BC_PopupMenu(0, 0, 0, "", 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+ this->keyframe_autos = 0;
+}
+
+KeyframeHidePopup::~KeyframeHidePopup()
+{
+}
+
+void KeyframeHidePopup::create_objects()
+{
+ add_item(new KeyframePopupHide(mwindow, this));
+}
+
+int KeyframeHidePopup::update(Autos *autos)
+{
+ this->keyframe_autos = autos;
+ return 0;
+}
+
+KeyframePopupHide::KeyframePopupHide(MWindow *mwindow, KeyframeHidePopup *popup)
+ : BC_MenuItem(_("Hide keyframe type"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+int KeyframePopupHide::handle_event()
+{
+// Get the array index of the curve
+ int update_gui = 0;
+ if(popup->keyframe_autos)
+ {
+ if(popup->keyframe_autos->type == Autos::AUTOMATION_TYPE_PLUGIN)
+ {
+ mwindow->edl->session->auto_conf->plugins = 0;
+ update_gui = 1;
+ }
+ else
+ {
+ Track *track = popup->keyframe_autos->track;
+ if(track)
+ {
+ Automation *automation = track->automation;
+ if(automation)
+ {
+ for(int i = 0; i < AUTOMATION_TOTAL; i++)
+ {
+ if(automation->autos[i] == popup->keyframe_autos)
+ {
+ mwindow->edl->session->auto_conf->autos[i] = 0;
+ update_gui = 1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(update_gui)
+ {
+ mwindow->gui->update(0,
+ 1, // 1 for incremental drawing. 2 for full refresh
+ 0,
+ 0,
+ 0,
+ 0,
+ 0);
+ mwindow->gui->mainmenu->update_toggles(1);
+ mwindow->gui->unlock_window();
+ mwindow->gwindow->gui->update_toggles(1);
+ mwindow->gui->lock_window("KeyframePopupHide::handle_event");
+ }
+
+ return 1;
+}
#include "plugin.inc"
#include "plugindialog.inc"
#include "keyframe.inc"
+#include "keyframepopup.inc"
#include "automation.h"
#include "floatauto.h"
-class KeyframePopupDelete;
-class KeyframePopupShow;
-class KeyframePopupCopy;
-class KeyframePopupCurveMode;
-class KeyframePopupEdit;
-
class KeyframePopup : public BC_PopupMenu
{
KeyframePopup *popup;
};
+class KeyframeHidePopup : public BC_PopupMenu
+{
+public:
+ KeyframeHidePopup(MWindow *mwindow, MWindowGUI *gui);
+ ~KeyframeHidePopup();
+
+ void create_objects();
+ int update(Autos *autos);
+
+ MWindow *mwindow;
+ MWindowGUI *gui;
+ Autos *keyframe_autos;
+};
+
+class KeyframePopupHide : public BC_MenuItem
+{
+public:
+ KeyframePopupHide(MWindow *mwindow, KeyframeHidePopup *popup);
+ int handle_event();
+
+ MWindow *mwindow;
+ KeyframeHidePopup *popup;
+};
+
#endif
#ifndef KEYFRAMEPOPUP_INC
#define KEYFRAMEPOPUP_INC
-
-
-
-
class KeyframePopup;
-
-
-
-
-
+class KeyframePopupDelete;
+class KeyframePopupShow;
+class KeyframePopupCopy;
+class KeyframePopupCurveMode;
+class KeyframePopupEdit;
+class KeyframePopupHide;
+class KeyframeHidePopup;
+
#endif
edit_menu = 0;
plugin_menu = 0;
keyframe_menu = 0;
+ keyframe_hide = 0;
transition_menu = 0;
remote_control = 0;
cwindow_remote_handler = 0;
if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
add_subwindow(keyframe_menu = new KeyframePopup(mwindow, this));
keyframe_menu->create_objects();
+ add_subwindow(keyframe_hide = new KeyframeHidePopup(mwindow, this));
+ keyframe_hide->create_objects();
if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
EditPopup *edit_menu;
PluginPopup *plugin_menu;
KeyframePopup *keyframe_menu;
+ KeyframeHidePopup *keyframe_hide;
TransitionPopup *transition_menu;
MainClock *mainclock;
gui->keyframe_menu->activate_menu();
rerender = 1; // the position changes
}
+ else if( autos )
+ {
+ gui->keyframe_hide->update(autos);
+ gui->keyframe_hide->activate_menu();
+ rerender = 1; // the position changes
+ }
if(buttonpress == 1 && ctrl_down() &&
AUTOMATION_TYPE_FLOAT == autos->get_type())
rerender = 1; // special case: curve mode changed
// Not using slope intercept
x1 = MAX(0, x1);
- int prev_y = y1;
+ int prev_y = y1 + center_pixel;
// Call by reference fails for some reason here
// (int)(center_pixel - yscale / 2),
// (int)(center_pixel + yscale / 2 - 1));
+//printf("draw_line(%d,%d, %d,%d)\n", x - 1, prev_y , x, y);
draw_line(x - 1, prev_y , x, y );
}
prev_y = y;
autos->first ? autos->first : autos->default_auto;
double ax = 0, ay = 0, ax2 = 0, ay2 = 0;
- if( first_auto )
+ if( first_auto ) {
calculate_auto_position(&ax, &ay, 0, 0, 0, 0,
first_auto, unit_start, zoom_units, yscale, autogrouptype);
-
+ }
if( current )
current = NEXT;
else {
void BC_Display::arm_repeat(int64_t duration)
{
- XEvent *event = new XEvent;
+ XEvent *event = BC_WindowBase::new_xevent();
XClientMessageEvent *ptr = (XClientMessageEvent*)event;
event->xany.window = 0;
ptr->type = ClientMessage;
void BC_Display::arm_completion(BC_WindowBase *window)
{
- XEvent *event = new XEvent;
+ XEvent *event = BC_WindowBase::new_xevent();
XClientMessageEvent *ptr = (XClientMessageEvent*)event;
event->xany.window = window->win;
event->type = ClientMessage;
return 0;
}
-int BC_Menu::remove_item(BC_MenuItem *item)
+int BC_Menu::del_item(BC_MenuItem *item)
{
- menu_popup->remove_item(item, 0);
+ menu_popup->del_item(item);
return 0;
}
// Called by user to add items
int add_item(BC_MenuItem* menuitem);
// Remove the item ptr and the object
- int remove_item(BC_MenuItem* item = 0);
+ int del_item(BC_MenuItem* item=0);
int total_menuitems();
int set_text(char *text);
hotkey_text = 0;
if(submenu) delete submenu;
submenu = 0;
-// deletes this
- if(menu_popup) menu_popup->remove_item(this, 1);
+ if(menu_popup)
+ menu_popup->remove_item(this);
}
void BC_MenuItem::reset()
return 0;
}
-int BC_MenuPopup::remove_item(BC_MenuItem *item, int recursive)
+int BC_MenuPopup::remove_item(BC_MenuItem *item)
+{
+ menu_items.remove(item);
+}
+
+int BC_MenuPopup::del_item(BC_MenuItem *item)
{
if(!item && menu_items.size() > 0)
{
if(item)
{
- menu_items.remove(item);
+ remove_item(item);
item->menu_popup = 0;
- if(!recursive) delete item;
+ delete item;
}
return 0;
}
BC_MenuItem *menu_item,
BC_PopupMenu *popup_menu);
int add_item(BC_MenuItem *item);
- int remove_item(BC_MenuItem* item /* = 0 */, int recursive);
+ int del_item(BC_MenuItem* item);
+ int remove_item(BC_MenuItem* item);
int total_menuitems();
// Deactivates all submenus in a downward progression except for the exclude
int BC_PopupMenu::remove_item(BC_MenuItem *item)
{
- menu_popup->remove_item(item, 0);
+ menu_popup->remove_item(item);
+ return 0;
+}
+
+int BC_PopupMenu::del_item(BC_MenuItem *item)
+{
+ menu_popup->del_item(item);
return 0;
}
char* get_text();
int initialize();
int add_item(BC_MenuItem *item);
+ int del_item(BC_MenuItem *item);
int remove_item(BC_MenuItem *item);
int total_items();
BC_MenuItem* get_item(int i);
}
}
-void BC_TextBox::set_selection(int char1, int char2, int ibeam)
+void BC_TextBox::wset_selection(int char1, int char2, int ibeam)
{
highlight_letter1 = char1;
highlight_letter2 = char2;
draw(1);
}
+// count utf8 chars in text which occur before cp
+int BC_TextBox::wcpos(const char *text, const char *cp)
+{
+ int len = 0;
+ const unsigned char *bp = (const unsigned char *)text;
+ const unsigned char *ep = (const unsigned char *)cp;
+ while( bp < ep && *bp != 0 ) {
+ ++len;
+ int ch = *bp++;
+ if( ch < 0x80 ) continue;
+ int i = ch - 0x0c0;
+ int n = i<0? 0 : i<32? 1 : i<48? 2 : i<56? 3 : i<60? 4 : 5;
+ for( i=n; bp < ep && --i>=0 && (*bp&0xc0) == 0x80; ++bp );
+ }
+ return len;
+}
+
+void BC_TextBox::set_selection(int char1, int char2, int ibeam)
+{
+ const char *cp = get_text();
+ wset_selection(wcpos(cp, cp+char1), wcpos(cp, cp+char2), wcpos(cp, cp+ibeam));
+}
+
int BC_TextBox::update(const char *text)
{
//printf("BC_TextBox::update 1 %d %s %s\n", tstrcmp(text), text, this->text);
}
-
-
-
-
-
-
BC_ScrollTextBox::BC_ScrollTextBox(BC_WindowBase *parent_window,
int x, int y, int w, int rows,
const char *default_text, int default_size)
this->text->set_selection(char1, char2, ibeam);
}
+void BC_ScrollTextBox::wset_selection(int char1, int char2, int ibeam)
+{
+ this->text->wset_selection(char1, char2, ibeam);
+}
+
// Whenever the position of the text changes
virtual int motion_event() { return 0; };
void set_selection(int char1, int char2, int ibeam);
+ void wset_selection(int char1, int char2, int ibeam);
int update(const char *text);
int update(const wchar_t *wtext);
int update(int64_t value);
// Set top left of text view
void set_text_row(int row);
int get_text_row();
+
int reposition_window(int x, int y, int w = -1, int rows = -1);
int uses_text();
#ifdef X_HAVE_UTF8_STRING
static int calculate_h(BC_WindowBase *gui, int font, int has_border, int rows);
static int calculate_row_h(int rows, BC_WindowBase *parent_window, int has_border = 1, int font = MEDIUMFONT);
static int pixels_to_rows(BC_WindowBase *window, int font, int pixels);
+ static int wcpos(const char *text, const char *ep);
+
void set_precision(int precision);
// Whether to draw every time there is a keypress or rely on user to
// follow up every keypress with an update().
void update(const char *text);
void update(const wchar_t *wtext);
void set_selection(int char1, int char2, int ibeam);
+ void wset_selection(int char1, int char2, int ibeam);
void reposition_window(int x, int y, int w, int rows);
int get_x();
int get_y();
// return top_level->next_repeat_id++;
// }
+XEvent *BC_WindowBase::new_xevent()
+{
+ XEvent *event = new XEvent;
+ memset(event, 0, sizeof(*event));
+ return event;
+}
#ifndef SINGLE_THREAD
int BC_WindowBase::arm_repeat(int64_t duration)
{
- XEvent *event = new XEvent;
+ XEvent *event = new_xevent();
XClientMessageEvent *ptr = (XClientMessageEvent*)event;
ptr->type = ClientMessage;
ptr->message_type = RepeaterXAtom;
int BC_WindowBase::send_custom_xatom(xatom_event *event)
{
- XEvent *myevent = new XEvent;
+ XEvent *myevent = new_xevent();
XClientMessageEvent *ptr = (XClientMessageEvent*)myevent;
ptr->type = ClientMessage;
ptr->message_type = event->message_type;
#else // SINGLE_THREAD
init_wait();
if( !event_thread ) return;
- XEvent *event = new XEvent;
+ XEvent *event = new_xevent();
XClientMessageEvent *ptr = (XClientMessageEvent*)event;
event->type = ClientMessage;
ptr->message_type = SetDoneXAtom;
int trigger_tooltip();
int untrigger_tooltip();
void draw_tooltip();
- int arm_repeat(int64_t duration);
+ static XEvent *new_xevent();
// delete all repeater opjects for a close
int unset_all_repeaters();
#ifndef SINGLE_THREAD
// Array of repeaters for multiple repeating objects.
ArrayList<BC_Repeater*> repeaters;
+ int arm_repeat(int64_t duration);
#endif
// Text for tooltip if one exists
const char *tooltip_text;
// int total = total_items();
// for(int i = 0; i < total; i++)
// {
-// BC_MenuItem *item = get_item(0);
-// remove_item(item);
+// del_item();
// }
//
// // Create current items
msgid "Texts:"
msgstr "Texte:"
+#: cinelerra//swindow.C:202
+msgid ""
+"Adding Subtitles: quick \"How To\" (= or * indicates comment)\n"
+"*2345678901234567890123456789012345678901234567890123456789\n"
+"For regular DVD subtitles, put script in a text file. Lines can be any length but they will be broken up to fit according to some criteria below.\n"
+"Running text used as script lines will be broken into multilple lines.\n"
+"The target line length is 60 characters.\n"
+"Punctuation may be flagged to create an early line break.\n"
+"Single carriage return ends an individual script line.\n"
+"Double carriage return indicates the end of an entry.\n"
+"Whitespace at beginning or end of line is removed.\n"
+"You can edit the active line in the Line Text box.\n"
+"\n"
+"== A new entry is here for illustration purposes.\n"
+"* Entry 2\n"
+"This is the second entry.\n"
+msgstr ""
+"Hinzufügen von Untertiteln: schnell \"How To\" (= oder * zeigt Kommentar)\n"
+"* 2345678901234567890123456789012345678901234567890123456789\n"
+"Für normalen DVD-Untertitel, setzen Skript in einer Textdatei. "
+"Linien können beliebig lang sein, aber sie werden "
+"aufgeteilt nach einigen Kriterien unten zu passen.\n"
+"Lauftext als Skriptzeilen verwendet\n"
+"wird in multilple Linien gebrochen werden.\n"
+"Die Zielzeilenlänge beträgt 60 Zeichen.\n"
+"Interpunktion kann eine frühe Zeilenumbruch zu erstellen markiert.\n"
+"Einzelwagenrücklauf endet eine individuelle Skriptzeile .\n"
+"Doppelwagenrücklauf zeigt das Ende eines Eintrags.\n"
+"Leerzeichen am Anfang oder Ende der Zeile wird entfernt.\n"
+"Sie können die aktive Zeile in der Zeile Textfeld bearbeiten.\n"
+"\n"
+"== Ein neuer Eintrag ist hier zur Illustration.\n"
+"* Eintrag 2\n"
+"Dies ist der zweite Eintrag.\n"
+
#: cinelerra//swindow.C:216
msgid ": Subtitle"
msgstr ": Untertitel"