{
gui->stop_vicon_drawing();
+ if(get_button_down() && get_buttonpress() == 3)
+ {
+ gui->folderlist_menu->update_titles();
+ gui->folderlist_menu->activate_menu();
+ }
+
strcpy(mwindow->edl->session->current_folder, picon->get_text());
//printf("AWindowFolders::selection_changed 1\n");
gui->asset_list->draw_background();
}
int AWindowFolders::button_press_event()
-{
- return BC_ListBox::button_press_event();
-}
-
-int AWindowFolders::button_release_event()
{
int result = 0;
- if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
+
+ result = BC_ListBox::button_press_event();
+
+ if(!result)
{
- gui->folderlist_menu->update_titles();
- gui->folderlist_menu->activate_menu();
- result = 1;
+ if(get_buttonpress() == 3 && is_event_win() && cursor_inside())
+ {
+ gui->folderlist_menu->update_titles();
+ gui->folderlist_menu->activate_menu();
+ result = 1;
+ }
}
- else
- result = BC_ListBox::button_release_event();
+
+
return result;
}
+
AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
: BC_ListBox(x,
y,
}
int AWindowAssets::button_press_event()
-{
- return BC_ListBox::button_press_event();
-}
-
-int AWindowAssets::button_release_event()
{
int result = 0;
- if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) {
- if( !strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
- !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
- !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
- !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) {
- BC_ListBox::deactivate_selection();
- gui->assetlist_menu->update_titles();
- gui->assetlist_menu->activate_menu();
- }
- else if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) {
- gui->label_menu->update();
- gui->label_menu->activate_menu();
- }
- else {
- gui->asset_menu->update();
- gui->asset_menu->activate_menu();
- }
+
+ result = BC_ListBox::button_press_event();
+
+ if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside())
+ {
+ BC_ListBox::deactivate_selection();
+ gui->assetlist_menu->update_titles();
+ gui->assetlist_menu->activate_menu();
result = 1;
}
- else
- result = BC_ListBox::button_release_event();
+
+
return result;
}
int AWindowAssets::selection_changed()
{
// Show popup window
- if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
+ if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0))
+ {
+ if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) ||
+ !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) ||
+ !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) ||
+ !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER))
+ {
+ gui->assetlist_menu->update_titles();
+ gui->assetlist_menu->activate_menu();
+ }
+ else
+ if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER))
+ {
+ if(((AssetPicon*)get_selection(0, 0))->label)
+ gui->label_menu->activate_menu();
+ }
+ else
+ {
+ if(((AssetPicon*)get_selection(0, 0))->indexable)
+ gui->asset_menu->update();
+ else
+ if(((AssetPicon*)get_selection(0, 0))->edl)
+ gui->asset_menu->update();
+
+
+
+ gui->asset_menu->activate_menu();
+ }
+
+ BC_ListBox::deactivate_selection();
+ return 1;
+ }
+ else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
VIcon *vicon = 0;
if( !gui->vicon_thread->viewing ) {
AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
int drag_motion_event();
int drag_stop_event();
int button_press_event();
- int button_release_event();
int column_resize_event();
int focus_in_event();
int focus_out_event();
int selection_changed();
int button_press_event();
- int button_release_event();
MWindow *mwindow;
AWindowGUI *gui;
}
-int Canvas::button_release_event()
+int Canvas::button_press_event()
{
int result = 0;
- BC_WindowBase *cvs = get_canvas();
- if( cvs->is_event_win() && cvs->get_buttonpress() == 3 && cvs->cursor_inside() )
+ if(get_canvas()->get_buttonpress() == 3)
{
if(get_fullscreen())
fullscreen_menu->activate_menu();
void CanvasPopup::create_objects()
{
+ add_item(new BC_MenuItem("-"));
add_item(new CanvasFullScreenItem(canvas));
add_item(new CanvasPopupSize(canvas, _("Zoom 25%"), 0.25));
add_item(new CanvasPopupSize(canvas, _("Zoom 33%"), 0.33));
virtual void zoom_auto() {};
virtual int cursor_leave_event() { return 0; };
virtual int cursor_enter_event() { return 0; };
- virtual int button_release_event();
- virtual int button_press_event() { return 0; };
+ virtual int button_release_event() { return 0; };
+ virtual int button_press_event();
virtual int cursor_motion_event() { return 0; };
virtual void draw_overlays() { };
virtual void toggle_controls() { } ;
x = mwindow->theme->preferencesoptions_x;
y = mwindow->theme->preferencesoptions_y;
- add_subwindow(new BC_Title(x, y,
- _("Time Format"),
- LARGEFONT,
+ add_subwindow(new BC_Title(x, y, _("Time Format"), LARGEFONT,
+ resources->text_default));
+ int x1 = get_w()/2;
+ add_subwindow(new BC_Title(x1, y, _("Flags"), LARGEFONT,
resources->text_default));
y += get_text_height(LARGEFONT) + 5;
-
int y1 = y;
add_subwindow(hms = new TimeFormatHMS(pwindow, this,
pwindow->thread->edl->session->time_format == TIME_FRAMES,
x, y));
y += 20;
- int x1 = x;
+ int x0 = x;
add_subwindow(feet = new TimeFormatFeet(pwindow, this,
pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
- x1, y));
- x1 += feet->get_w() + margin;
+ x0, y));
+ x0 += feet->get_w() + 15;
BC_Title *title;
- add_subwindow(title = new BC_Title(x1, y, _("Frames per foot:")));
- x1 += title->get_w() + margin;
+ add_subwindow(title = new BC_Title(x0, y, _("Frames per foot:")));
+ x0 += title->get_w() + margin;
sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
add_subwindow(new TimeFormatFeetSetting(pwindow,
- x1, y - 5, string));
+ x0, y - 5, string));
y += 20;
add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
pwindow->thread->edl->session->time_format == TIME_SECONDS,
x, y));
y += 35;
- x1 = get_w()/2;
UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1);
add_subwindow(tip_win);
y1 += tip_win->get_h() + 5;
UseWarnIndecies *idx_win = new UseWarnIndecies(pwindow, x1, y1);
add_subwindow(idx_win);
- y1 += tip_win->get_h() + 5;
+ y1 += idx_win->get_h() + 5;
UseWarnVersion *ver_win = new UseWarnVersion(pwindow, x1, y1);
add_subwindow(ver_win);
- y1 += idx_win->get_h() + 25;
+ y1 += ver_win->get_h() + 5;
+ PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1);
+ add_subwindow(pop_win);
+ y1 += pop_win->get_h() + 25;
add_subwindow(new BC_Bar(5, y, get_w() - 10));
y += 5;
return 1;
}
+PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
+ : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
+ _("Popups activate on button up"))
+{
+ this->pwindow = pwindow;
+}
+
+int PopupMenuBtnup::handle_event()
+{
+ pwindow->thread->preferences->popupmenu_btnup = get_value();
+ return 1;
+}
+
ScanCommercials::ScanCommercials(PreferencesWindow *pwindow, int x, int y)
: BC_CheckBox(x,
class StillImageUseDuration;
class StillImageDuration;
class KeyframeReticle;
+class PopupMenuBtnup;
#include "browsebutton.h"
#include "deleteallindexes.inc"
PreferencesWindow *pwindow;
};
+class PopupMenuBtnup : public BC_CheckBox
+{
+public:
+ PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y);
+ int handle_event();
+ PreferencesWindow *pwindow;
+};
+
class AndroidPIN : public BC_TextBox
{
public:
{
this->mwindow = mwindow;
this->gui = gui;
+ key_hide = 0;
key_show = 0;
key_delete = 0;
key_copy = 0;
void KeyframePopup::create_objects()
{
+ add_item(key_hide = new KeyframePopupHide(mwindow, this));
add_item(key_show = new KeyframePopupShow(mwindow, this));
add_item(key_delete = new KeyframePopupDelete(mwindow, this));
add_item(key_copy = new KeyframePopupCopy(mwindow, this));
return 1;
}
+KeyframePopupHide::KeyframePopupHide(MWindow *mwindow, KeyframePopup *popup)
+ : BC_MenuItem(_("Hide keyframe type"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+KeyframePopupHide::~KeyframePopupHide()
+{
+}
+
+int KeyframePopupHide::handle_event()
+{
+ if( popup->keyframe_autos )
+ mwindow->set_auto_visibility(popup->keyframe_autos, 0);
+ return 1;
+}
+
KeyframePopupShow::KeyframePopupShow(MWindow *mwindow, KeyframePopup *popup)
: BC_MenuItem(_("Show keyframe settings"))
{
void KeyframeHidePopup::create_objects()
{
- add_item(new KeyframePopupHide(mwindow, this));
+ add_item(new KeyframeHideItem(mwindow, this));
}
int KeyframeHidePopup::update(Autos *autos)
return 0;
}
-KeyframePopupHide::KeyframePopupHide(MWindow *mwindow, KeyframeHidePopup *popup)
+KeyframeHideItem::KeyframeHideItem(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");
- }
+int KeyframeHideItem::handle_event()
+{
+ if( popup->keyframe_autos )
+ mwindow->set_auto_visibility(popup->keyframe_autos, 0);
return 1;
}
private:
KeyframePopupDelete *key_delete;
+ KeyframePopupHide *key_hide;
KeyframePopupShow *key_show;
KeyframePopupCopy *key_copy;
KeyframePopupEdit *key_edit;
KeyframePopupDelete(MWindow *mwindow, KeyframePopup *popup);
~KeyframePopupDelete();
int handle_event();
+
+ MWindow *mwindow;
+ KeyframePopup *popup;
+};
+
+class KeyframePopupHide : public BC_MenuItem
+{
+public:
+ KeyframePopupHide(MWindow *mwindow, KeyframePopup *popup);
+ ~KeyframePopupHide();
+ int handle_event();
MWindow *mwindow;
KeyframePopup *popup;
Autos *keyframe_autos;
};
-class KeyframePopupHide : public BC_MenuItem
+class KeyframeHideItem : public BC_MenuItem
{
public:
- KeyframePopupHide(MWindow *mwindow, KeyframeHidePopup *popup);
+ KeyframeHideItem(MWindow *mwindow, KeyframeHidePopup *popup);
int handle_event();
MWindow *mwindow;
keyframemenu->add_item(new ClearKeyframes(mwindow));
keyframemenu->add_item(new StraightenKeyframes(mwindow));
keyframemenu->add_item(new BendKeyframes(mwindow));
- keyframemenu->add_item(keyframe_curve_type =
- new KeyframeCurveType(mwindow,
- mwindow->edl->local_session->floatauto_type));
+ keyframemenu->add_item(keyframe_curve_type = new KeyframeCurveType(mwindow));
keyframe_curve_type->create_objects();
+ keyframe_curve_type->update(mwindow->edl->local_session->floatauto_type);
keyframemenu->add_item(new BC_MenuItem("-"));
keyframemenu->add_item(new CopyDefaultKeyframe(mwindow));
keyframemenu->add_item(new PasteDefaultKeyframe(mwindow));
-KeyframeCurveType::KeyframeCurveType(MWindow *mwindow, int curve_type)
+KeyframeCurveType::KeyframeCurveType(MWindow *mwindow)
: BC_MenuItem(_("Create curve type..."))
{
this->mwindow = mwindow;
- this->curve_type = curve_type;
this->curve_menu = 0;
}
KeyframeCurveType::~KeyframeCurveType()
void KeyframeCurveType::create_objects()
{
- curve_menu = new KeyframeCurveTypeMenu(this);
- mwindow->gui->add_subwindow(curve_menu);
+ add_submenu(curve_menu = new KeyframeCurveTypeMenu(this));
for( int i=FloatAuto::SMOOTH; i<=FloatAuto::FREE; ++i ) {
- curve_menu->add_item(new KeyframeCurveTypeItem(i));
+ KeyframeCurveTypeItem *curve_type_item = new KeyframeCurveTypeItem(i, this);
+ curve_menu->add_submenuitem(curve_type_item);
}
}
-int KeyframeCurveType::handle_event()
+void KeyframeCurveType::update(int curve_type)
{
for( int i=0; i<curve_menu->total_items(); ++i ) {
- KeyframeCurveTypeItem *curve_type_item =
- (KeyframeCurveTypeItem *)curve_menu->get_item(i);
+ KeyframeCurveTypeItem *curve_type_item = (KeyframeCurveTypeItem *)curve_menu->get_item(i);
curve_type_item->set_checked(curve_type_item->type == curve_type);
}
- curve_menu->activate_menu();
+}
+
+int KeyframeCurveType::handle_event()
+{
return 1;
}
KeyframeCurveTypeMenu::KeyframeCurveTypeMenu(KeyframeCurveType *menu_item)
- : BC_PopupMenu(0, 0, 0, "", 0)
+ : BC_SubMenu()
{
this->menu_item = menu_item;
}
{
}
-KeyframeCurveTypeItem::KeyframeCurveTypeItem(int type)
+KeyframeCurveTypeItem::KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item)
: BC_MenuItem(FloatAuto::curve_name(type))
{
this->type = type;
+ this->main_item = main_item;
}
KeyframeCurveTypeItem::~KeyframeCurveTypeItem()
{
int KeyframeCurveTypeItem::handle_event()
{
- KeyframeCurveType *menu_item = ((KeyframeCurveTypeMenu *)get_popup_menu())->menu_item;
- menu_item->curve_type = type;
- menu_item->mwindow->set_keyframe_type(type);
+ main_item->update(type);
+ main_item->mwindow->set_keyframe_type(type);
return 1;
}
class KeyframeCurveType : public BC_MenuItem
{
public:
- KeyframeCurveType(MWindow *mwindow, int curve_type);
+ KeyframeCurveType(MWindow *mwindow);
~KeyframeCurveType();
void create_objects();
+ void update(int curve_type);
int handle_event();
MWindow *mwindow;
KeyframeCurveTypeMenu *curve_menu;
- int curve_type;
};
-class KeyframeCurveTypeMenu : public BC_PopupMenu
+class KeyframeCurveTypeMenu : public BC_SubMenu
{
public:
KeyframeCurveTypeMenu(KeyframeCurveType *menu_item);
class KeyframeCurveTypeItem : public BC_MenuItem
{
public:
- KeyframeCurveTypeItem(int type);
+ KeyframeCurveTypeItem(int type, KeyframeCurveType *main_item);
~KeyframeCurveTypeItem();
- int handle_event();
+ KeyframeCurveType *main_item;
int type;
+
+ int handle_event();
};
class CutDefaultKeyframe : public BC_MenuItem
#include "asset.h"
#include "assets.h"
#include "audioalsa.h"
+#include "autos.h"
#include "awindowgui.h"
#include "awindow.h"
#include "batchrender.h"
restart_status = 0;
screens = 1;
in_destructor = 0;
- warn_version = 1;
}
BC_Signals::set_trap_hook(trap_hook, this);
BC_Signals::set_catch_segv(preferences->trap_sigsegv);
BC_Signals::set_catch_intr(preferences->trap_sigintr);
+ BC_WindowBase::get_resources()->popupmenu_btnup = preferences->popupmenu_btnup;
}
void MWindow::clean_indexes()
if(lock_cwindow) cwindow->gui->unlock_window();
}
+void MWindow::set_auto_visibility(Autos *autos, int value)
+{
+ if( autos->type == Autos::AUTOMATION_TYPE_PLUGIN )
+ edl->session->auto_conf->plugins = value;
+ else if( autos->autoidx >= 0 )
+ edl->session->auto_conf->autos[autos->autoidx] = value;
+ else
+ return;
+
+ gui->update(0, 1, 0, 0, 0, 0, 0);
+ gui->mainmenu->update_toggles(1);
+ gui->unlock_window();
+ gwindow->gui->update_toggles(1);
+ gui->lock_window("MWindow::set_auto_visibility");
+}
+
void MWindow::set_keyframe_type(int mode)
{
gui->lock_window("MWindow::set_keyframe_type");
#include "asset.inc"
#include "assets.inc"
#include "audiodevice.inc"
+#include "autos.inc"
#include "awindow.inc"
#include "batchrender.inc"
#include "bcwindowbase.inc"
void set_automation_mode(int mode);
void set_keyframe_type(int mode);
void set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow);
+ void set_auto_visibility(Autos *autos, int value);
void set_labels_follow_edits(int value);
// Update the editing mode
int restart_status;
int screens;
int in_destructor;
- int warn_version;
};
#endif
ffmpeg_marker_indexes = 1;
warn_indexes = 1;
warn_version = 1;
+ popupmenu_btnup = 1;
dvd_yuv420p_interlace = 0;
// Default brender asset
ffmpeg_marker_indexes = that->ffmpeg_marker_indexes;
warn_indexes = that->warn_indexes;
warn_version = that->warn_version;
+ popupmenu_btnup = that->popupmenu_btnup;
dvd_yuv420p_interlace = that->dvd_yuv420p_interlace;
renderfarm_nodes.remove_all_objects();
renderfarm_ports.remove_all();
ffmpeg_marker_indexes = defaults->get("FFMPEG_MARKER_INDEXES", ffmpeg_marker_indexes);
warn_indexes = defaults->get("WARN_INDEXES", warn_indexes);
warn_version = defaults->get("WARN_VERSION", warn_version);
+ popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup);
dvd_yuv420p_interlace = defaults->get("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
use_brender = defaults->get("USE_BRENDER", use_brender);
brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment);
defaults->update("FFMPEG_MARKER_INDEXES", ffmpeg_marker_indexes);
defaults->update("WARN_INDEXES", warn_indexes);
defaults->update("WARN_VERSION", warn_version);
+ defaults->update("POPUPMENU_BTNUP", popupmenu_btnup);
defaults->update("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace);
brender_asset->save_defaults(defaults,
"BRENDER_",
// warning
int warn_indexes;
int warn_version;
+// popup menus activate on button release
+ int popupmenu_btnup;
// use dvd yuv420p interlace format
int dvd_yuv420p_interlace;
BC_Signals::set_catch_segv(mwindow->preferences->trap_sigsegv);
BC_Signals::set_catch_intr(mwindow->preferences->trap_sigintr);
+ BC_WindowBase::get_resources()->popupmenu_btnup = mwindow->preferences->popupmenu_btnup;
mwindow->reset_android_remote();
mwindow->gui->ffmpeg_toggle->update(mwindow->preferences->ffmpeg_early_probe);
{
if(mwindow->session->rwindow_fullscreen && canvas && canvas->get_canvas())
return canvas->button_press_event_base(canvas->get_canvas());
+
+ if( get_buttonpress() == 2 ) {
+ return 0;
+ }
+ else
+// Right button
+ if( get_buttonpress() == 3 ) {
+ monitor_menu->activate_menu();
+ return 1;
+ }
return 0;
}
int RecordMonitorGUI::button_release_event()
{
- if( get_buttonpress() == 3 && cursor_inside() ) {
- monitor_menu->activate_menu();
- return 1;
- }
if( canvas && canvas->get_canvas() )
return canvas->button_release_event();
return 0;
}
int RecordMonitorFullsize::handle_event()
{
- Record *record = window->record;
- record->video_zoom = 1.0;
- record->record_gui->set_translation(record->video_x, record->video_y, record->video_zoom);
return 1;
}
default:
- if( !mwindow->session->current_operation ) {
- if( get_buttonpress() == 3 )
- result = do_edit_popup();
- }
- else {
+ if(mwindow->session->current_operation) {
// if(mwindow->session->current_operation == SELECT_REGION) {
// mwindow->undo->update_undo_after(_("select"), LOAD_SESSION, 0, 0);
// }
int TrackCanvas::do_tracks(int cursor_x, int cursor_y, int button_press)
-{
- return 0;
-}
-
-int TrackCanvas::do_edit_popup()
{
int result = 0;
- int cursor_y = get_cursor_y();
+
// if(!mwindow->edl->session->show_assets) return 0;
for(Track *track = mwindow->edl->tracks->first;
int64_t track_x, track_y, track_w, track_h;
track_dimensions(track, track_x, track_y, track_w, track_h);
- if( cursor_y >= track_y && cursor_y < track_y + track_h ) {
+ if(button_press && get_buttonpress() == 3 &&
+ cursor_y >= track_y && cursor_y < track_y + track_h) {
gui->edit_menu->update(track, 0);
gui->edit_menu->activate_menu();
result = 1;
int do_tracks(int cursor_x,
int cursor_y,
int button_press);
- int do_edit_popup();
int test_resources(int cursor_x, int cursor_y);
int do_plugins(int cursor_x,
int cursor_y,
AC_MSG_ERROR("fatal eror.")
fi
CHECK_PROG(PACTL, [pactl])
+WANT_PACTL=$PROG_PACTL
AC_CHECK_DECL([X_HAVE_UTF8_STRING],,[no_utf=yes],[#include <X11/Xlib.h>])
if test "$no_utf" = "yes"; then
echo ""
for v in GL XFT XXF86VM OSS ALSA FIREWIRE DV DVB \
- VIDEO4LINUX2 ESOUND; do
+ VIDEO4LINUX2 ESOUND PACTL; do
eval vv="\$WANT_$v"
if test "x$vv" != "xno"; then
CFG_CFLAGS+=" -DHAVE_$v"
return 0;
}
-int BC_Menu::total_menuitems()
+int BC_Menu::total_items()
{
- return menu_popup->total_menuitems();
+ return menu_popup->total_items();
}
int BC_Menu::dispatch_button_press()
int add_item(BC_MenuItem* menuitem);
// Remove the item ptr and the object
int del_item(BC_MenuItem* item=0);
- int total_menuitems();
+ int total_items();
int set_text(char *text);
// Called by BC_Menubar
return 0;
}
-int BC_MenuPopup::total_menuitems()
+BC_MenuItem *BC_MenuPopup::get_item(int i)
{
- return menu_items.total;
+ return menu_items[i];
+}
+
+int BC_MenuPopup::total_items()
+{
+ return menu_items.size();
}
int BC_MenuPopup::dispatch_button_press()
int result = 0;
if(popup)
{
- for(int i = 0; i < menu_items.total && !result; i++)
+ for(int i = 0; i < menu_items.total && !result && popup; i++)
{
result = menu_items.values[i]->dispatch_button_press();
}
int result = 0, redraw = 0;
if(popup)
{
- for(int i = 0; i < menu_items.total && !result; i++)
+ for(int i = 0; i < menu_items.total && !result && popup; i++)
{
result = menu_items.values[i]->dispatch_button_release(redraw);
}
int BC_MenuPopup::cursor_inside()
{
- if( !popup ) return 0;
- int x = popup->get_relative_cursor_x();
- if( x < 0 || x > popup->get_w() ) return 0;
- int y = popup->get_relative_cursor_y();
- if( y < 0 || y > popup->get_h() ) return 0;
- return 1;
+ return !popup || !popup->cursor_above() ? 0 : 1;
}
int BC_MenuPopup::get_w()
BC_PopupMenu *popup_menu);
int add_item(BC_MenuItem *item);
int del_item(BC_MenuItem* item);
+ BC_MenuItem *get_item(int i);
+ int total_items();
int remove_item(BC_MenuItem* item);
- int total_menuitems();
// Deactivates all submenus in a downward progression except for the exclude
int deactivate_submenus(BC_MenuPopup *exclude = 0);
this->data = data;
this->w_argument = w;
status = BUTTON_UP;
+ pending = 0;
}
BC_PopupMenu::BC_PopupMenu(int x,
this->data = data;
this->w_argument = -1;
status = BUTTON_UP;
+ pending = 0;
}
BC_PopupMenu::~BC_PopupMenu()
int BC_PopupMenu::total_items()
{
- return menu_popup->total_menuitems();
- return 0;
+ return menu_popup->total_items();
}
BC_MenuItem* BC_PopupMenu::get_item(int i)
int BC_PopupMenu::activate_menu()
{
- if(!popup_down)
+ if( !get_button_down() || !BC_WindowBase::get_resources()->popupmenu_btnup )
+ return menu_activate();
+ pending = 1;
+ return 0;
+}
+
+int BC_PopupMenu::menu_activate()
+{
+ pending = 0;
+ if( !popup_down )
{
int x = this->x;
int y = this->y;
// Scrolling section
if (is_event_win()
&& (get_buttonpress() == 4 || get_buttonpress() == 5)
- && menu_popup->total_menuitems() > 1 )
+ && menu_popup->total_items() > 1 )
{
int theval = -1;
- for (int i = 0; i < menu_popup->total_menuitems(); i++) {
+ for (int i = 0; i < menu_popup->total_items(); i++) {
if (!strcmp(menu_popup->menu_items.values[i]->get_text(),get_text())) {
theval=i;
break;
if (theval < 0)
theval=0;
- if (theval >= menu_popup->total_menuitems())
- theval = menu_popup->total_menuitems() - 1;
+ if (theval >= menu_popup->total_items())
+ theval = menu_popup->total_items() - 1;
BC_MenuItem *tmp = menu_popup->menu_items.values[theval];
set_text(tmp->get_text());
{
// try the title
int result = 0;
+ if( pending )
+ return menu_activate();
if(is_event_win() && use_title)
{
if( !use_title && status == BUTTON_DN ) {
result = 1;
}
- else if(popup_down) {
+ else if( popup_down && menu_popup->cursor_inside() ) {
// Menu is down so dispatch to popup.
result = menu_popup->dispatch_button_release();
}
// released outside popup
- if( !result && popup_down ) {
+ if( get_resources()->popupmenu_btnup && !result && popup_down ) {
deactivate();
result = 1;
}
// dispatch to popup
if( popup_down ) {
- if( !get_button_down() && !menu_popup->cursor_inside() )
+ if( !get_button_down() && !menu_popup->cursor_inside() ) {
+ status = BUTTON_UP;
deactivate_menu();
+ }
menu_popup->dispatch_cursor_leave();
}
{
if(highlighted)
{
- if(cursor_inside())
+ if(!cursor_inside())
{
highlighted = 0;
draw_title(1);
int reposition_window(int x, int y);
int deactivate();
int activate_menu();
+ int menu_activate();
int deactivate_menu();
int focus_out_event();
int repeat_event(int64_t duration);
int button_press_x, button_press_y;
int w_argument;
int status;
+ int pending;
};
popupmenu_margin = 10;
+ popupmenu_btnup = 1;
popupmenu_triangle_margin = 10;
min_menu_w = 0;
int popup_title_text;
// Right and left margin for text not including triangle space.
int popupmenu_margin;
+// post popup on button release event
+ int popupmenu_btnup;
// Right margin for triangle not including text margin.
int popupmenu_triangle_margin;
// color for item text