mirror of https://github.com/KLayout/klayout.git
WIP: refactoring ongoing.
This commit is contained in:
parent
ebd5b3738e
commit
d6589f1d0e
|
|
@ -43,6 +43,145 @@ void enable_edits (lay::MainWindow * /*main_window*/, bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: match this with the cm_method_decl's below
|
||||
static const char *cm_symbols[] = {
|
||||
"cm_reset_window_state",
|
||||
"cm_select_all",
|
||||
"cm_unselect_all",
|
||||
"cm_undo",
|
||||
"cm_redo",
|
||||
"cm_delete",
|
||||
"cm_show_properties",
|
||||
"cm_copy",
|
||||
"cm_paste",
|
||||
"cm_cut",
|
||||
"cm_zoom_fit_sel",
|
||||
"cm_zoom_fit",
|
||||
"cm_zoom_in",
|
||||
"cm_zoom_out",
|
||||
"cm_pan_up",
|
||||
"cm_pan_down",
|
||||
"cm_pan_left",
|
||||
"cm_pan_right",
|
||||
"cm_save_session",
|
||||
"cm_restore_session",
|
||||
"cm_setup",
|
||||
"cm_save_as",
|
||||
"cm_save",
|
||||
"cm_save_all",
|
||||
"cm_reload",
|
||||
"cm_close",
|
||||
"cm_close_all",
|
||||
"cm_clone",
|
||||
"cm_layout_props",
|
||||
"cm_inc_max_hier",
|
||||
"cm_dec_max_hier",
|
||||
"cm_max_hier",
|
||||
"cm_max_hier_0",
|
||||
"cm_max_hier_1",
|
||||
"cm_prev_display_state|#cm_last_display_state",
|
||||
"cm_next_display_state",
|
||||
"cm_cancel",
|
||||
"cm_redraw",
|
||||
"cm_screenshot",
|
||||
"cm_save_layer_props",
|
||||
"cm_load_layer_props",
|
||||
"cm_save_bookmarks",
|
||||
"cm_load_bookmarks",
|
||||
"cm_select_cell",
|
||||
"cm_select_current_cell",
|
||||
"cm_print",
|
||||
"cm_exit",
|
||||
"cm_view_log",
|
||||
"cm_bookmark_view",
|
||||
"cm_manage_bookmarks",
|
||||
"cm_macro_editor",
|
||||
"cm_goto_position",
|
||||
"cm_help_about",
|
||||
"cm_technologies",
|
||||
"cm_packages",
|
||||
"cm_open_too",
|
||||
"cm_open_new_view",
|
||||
"cm_open",
|
||||
"cm_pull_in",
|
||||
"cm_reader_options",
|
||||
"cm_new_layout",
|
||||
"cm_new_panel",
|
||||
"cm_adjust_origin",
|
||||
"cm_new_cell",
|
||||
"cm_new_layer",
|
||||
"cm_clear_layer",
|
||||
"cm_delete_layer",
|
||||
"cm_edit_layer",
|
||||
"cm_copy_layer",
|
||||
"cm_sel_flip_x",
|
||||
"cm_sel_flip_y",
|
||||
"cm_sel_rot_cw",
|
||||
"cm_sel_rot_ccw",
|
||||
"cm_sel_free_rot",
|
||||
"cm_sel_scale",
|
||||
"cm_sel_move",
|
||||
"cm_sel_move_to",
|
||||
"cm_lv_new_tab",
|
||||
"cm_lv_remove_tab",
|
||||
"cm_lv_rename_tab",
|
||||
"cm_lv_hide",
|
||||
"cm_lv_hide_all",
|
||||
"cm_lv_show",
|
||||
"cm_lv_show_all",
|
||||
"cm_lv_show_only",
|
||||
"cm_lv_rename",
|
||||
"cm_lv_select_all",
|
||||
"cm_lv_delete",
|
||||
"cm_lv_insert",
|
||||
"cm_lv_group",
|
||||
"cm_lv_ungroup",
|
||||
"cm_lv_source",
|
||||
"cm_lv_sort_by_name",
|
||||
"cm_lv_sort_by_ild",
|
||||
"cm_lv_sort_by_idl",
|
||||
"cm_lv_sort_by_ldi",
|
||||
"cm_lv_sort_by_dli",
|
||||
"cm_lv_regroup_by_index",
|
||||
"cm_lv_regroup_by_datatype",
|
||||
"cm_lv_regroup_by_layer",
|
||||
"cm_lv_regroup_flatten",
|
||||
"cm_lv_expand_all",
|
||||
"cm_lv_add_missing",
|
||||
"cm_lv_remove_unused",
|
||||
"cm_cell_delete",
|
||||
"cm_cell_rename",
|
||||
"cm_cell_copy",
|
||||
"cm_cell_cut",
|
||||
"cm_cell_paste",
|
||||
"cm_cell_select",
|
||||
"cm_open_current_cell",
|
||||
"cm_save_current_cell_as",
|
||||
"cm_cell_hide",
|
||||
"cm_cell_flatten",
|
||||
"cm_cell_show",
|
||||
"cm_cell_show_all",
|
||||
"cm_navigator_close",
|
||||
"cm_navigator_freeze"
|
||||
};
|
||||
|
||||
template <unsigned int NUM>
|
||||
void call_cm_method (lay::MainWindow *mw)
|
||||
{
|
||||
tl_assert (NUM < sizeof (cm_symbols) / sizeof (cm_symbols [0]));
|
||||
mw->menu_activated (cm_symbols [NUM]);
|
||||
}
|
||||
|
||||
template <unsigned int NUM>
|
||||
gsi::Methods cm_method_decl ()
|
||||
{
|
||||
tl_assert (NUM < sizeof (cm_symbols) / sizeof (cm_symbols [0]));
|
||||
return gsi::method (std::string ("#") + cm_symbols [NUM], &call_cm_method<NUM>,
|
||||
std::string ("@brief '") + cm_symbols[NUM] + "' action.\n"
|
||||
"This method has been added in version 0.25 and is deprecated in version 0.27.\n"
|
||||
"Use \"call_menu('" + std::string (cm_symbols[NUM]) + "')\" instead.");
|
||||
}
|
||||
|
||||
Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "MainWindow",
|
||||
|
||||
// QMainWindow interface
|
||||
|
|
@ -378,405 +517,138 @@ Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "M
|
|||
"\n"
|
||||
"This method has been introduced in version 0.26.\n"
|
||||
) +
|
||||
gsi::method ("cm_reset_window_state", &lay::MainWindow::cm_reset_window_state,
|
||||
"@brief 'cm_reset_window_state' action (bound to a menu)"
|
||||
gsi::method ("call_menu", &lay::MainWindow::menu_activated,
|
||||
"@brief Calls the menu item with the provided symbol.\n"
|
||||
"To obtain all symbols, use get_menu_symbols.\n"
|
||||
"\n"
|
||||
"This method has been added in version 0.25.\n"
|
||||
"This method has been introduced in version 0.27 and replaces the previous cm_... methods. "
|
||||
"Instead of calling a specific cm_... method, use LayoutView#call_menu with 'cm_...' as the symbol."
|
||||
) +
|
||||
gsi::method ("cm_select_all", &lay::MainWindow::cm_select_all,
|
||||
"@brief 'cm_select_all' action (bound to a menu)"
|
||||
gsi::method ("get_menu_symbols", &lay::MainWindow::menu_symbols,
|
||||
"@brief Calls the menu item with the provided symbol.\n"
|
||||
"To obtain all available symbols, use get_menu_symbols.\n"
|
||||
"\n"
|
||||
"This method has been added in version 0.22.\n"
|
||||
) +
|
||||
gsi::method ("cm_unselect_all", &lay::MainWindow::cm_unselect_all,
|
||||
"@brief 'cm_unselect_all' action (bound to a menu)"
|
||||
"\n"
|
||||
"This method has been added in version 0.22.\n"
|
||||
) +
|
||||
gsi::method ("cm_undo", &lay::MainWindow::cm_undo,
|
||||
"@brief 'cm_undo' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_redo", &lay::MainWindow::cm_redo,
|
||||
"@brief 'cm_redo' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_delete", &lay::MainWindow::cm_delete,
|
||||
"@brief 'cm_delete' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_show_properties", &lay::MainWindow::cm_show_properties,
|
||||
"@brief 'cm_show_properties' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_copy", &lay::MainWindow::cm_copy,
|
||||
"@brief 'cm_copy' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_paste", &lay::MainWindow::cm_paste,
|
||||
"@brief 'cm_paste' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cut", &lay::MainWindow::cm_cut,
|
||||
"@brief 'cm_cut' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_zoom_fit_sel", &lay::MainWindow::cm_zoom_fit,
|
||||
"@brief 'cm_zoom_fit_sel' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_zoom_fit", &lay::MainWindow::cm_zoom_fit,
|
||||
"@brief 'cm_zoom_fit' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_zoom_in", &lay::MainWindow::cm_zoom_in,
|
||||
"@brief 'cm_zoom_in' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_zoom_out", &lay::MainWindow::cm_zoom_out,
|
||||
"@brief 'cm_zoom_out' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_pan_up", &lay::MainWindow::cm_pan_up,
|
||||
"@brief 'cm_pan_up' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_pan_down", &lay::MainWindow::cm_pan_down,
|
||||
"@brief 'cm_pan_down' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_pan_left", &lay::MainWindow::cm_pan_left,
|
||||
"@brief 'cm_pan_left' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_pan_right", &lay::MainWindow::cm_pan_right,
|
||||
"@brief 'cm_pan_right' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_save_session", &lay::MainWindow::cm_save_session,
|
||||
"@brief 'cm_save_session' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_restore_session", &lay::MainWindow::cm_restore_session,
|
||||
"@brief 'cm_restore_session' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_setup", &lay::MainWindow::cm_setup,
|
||||
"@brief 'cm_setup' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_save_as", &lay::MainWindow::cm_save_as,
|
||||
"@brief 'cm_save_as' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_save", &lay::MainWindow::cm_save,
|
||||
"@brief 'cm_save' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_save_all", &lay::MainWindow::cm_save_all,
|
||||
"@brief 'cm_save_all' action (bound to a menu)\n"
|
||||
"This method has been added in version 0.24.\n"
|
||||
) +
|
||||
gsi::method ("cm_reload", &lay::MainWindow::cm_reload,
|
||||
"@brief 'cm_reload' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_close", &lay::MainWindow::cm_close,
|
||||
"@brief 'cm_close' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_close_all", &lay::MainWindow::cm_close_all,
|
||||
"@brief 'cm_close_all' action (bound to a menu)\n"
|
||||
"This method has been added in version 0.24.\n"
|
||||
) +
|
||||
gsi::method ("cm_clone", &lay::MainWindow::cm_clone,
|
||||
"@brief 'cm_clone' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_layout_props", &lay::MainWindow::cm_layout_props,
|
||||
"@brief 'cm_layout_props' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_inc_max_hier", &lay::MainWindow::cm_inc_max_hier,
|
||||
"@brief 'cm_inc_max_hier' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_dec_max_hier", &lay::MainWindow::cm_dec_max_hier,
|
||||
"@brief 'cm_dec_max_hier' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_max_hier", &lay::MainWindow::cm_max_hier,
|
||||
"@brief 'cm_max_hier' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_max_hier_0", &lay::MainWindow::cm_max_hier_0,
|
||||
"@brief 'cm_max_hier_0' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_max_hier_1", &lay::MainWindow::cm_max_hier_1,
|
||||
"@brief 'cm_max_hier_1' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_prev_display_state|#cm_last_display_state", &lay::MainWindow::cm_prev_display_state,
|
||||
"@brief 'cm_prev_display_state' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_next_display_state", &lay::MainWindow::cm_next_display_state,
|
||||
"@brief 'cm_next_display_state' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cancel", &lay::MainWindow::cm_cancel,
|
||||
"@brief 'cm_cancel' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_redraw", &lay::MainWindow::cm_redraw,
|
||||
"@brief 'cm_redraw' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_screenshot", &lay::MainWindow::cm_screenshot,
|
||||
"@brief 'cm_screenshot' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_save_layer_props", &lay::MainWindow::cm_save_layer_props,
|
||||
"@brief 'cm_save_layer_props' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_load_layer_props", &lay::MainWindow::cm_load_layer_props,
|
||||
"@brief 'cm_load_layer_props' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_save_bookmarks", &lay::MainWindow::cm_save_bookmarks,
|
||||
"@brief 'cm_save_bookmarks' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_load_bookmarks", &lay::MainWindow::cm_load_bookmarks,
|
||||
"@brief 'cm_load_bookmarks' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_select_cell", &lay::MainWindow::cm_select_cell,
|
||||
"@brief 'cm_select_cell' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_select_current_cell", &lay::MainWindow::cm_select_current_cell,
|
||||
"@brief 'cm_select_current_cell' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_print", &lay::MainWindow::cm_print,
|
||||
"@brief 'cm_print' action (bound to a menu)\n"
|
||||
"This method has been added in version 0.21.13."
|
||||
) +
|
||||
gsi::method ("cm_exit", &lay::MainWindow::cm_exit,
|
||||
"@brief 'cm_exit' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_view_log", &lay::MainWindow::cm_view_log,
|
||||
"@brief 'cm_view_log' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_bookmark_view", &lay::MainWindow::cm_bookmark_view,
|
||||
"@brief 'cm_bookmark_view' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_manage_bookmarks", &lay::MainWindow::cm_manage_bookmarks,
|
||||
"@brief 'cm_manage_bookmarks' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_macro_editor", &lay::MainWindow::cm_macro_editor,
|
||||
"@brief 'cm_macro_editor' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_goto_position", &lay::MainWindow::cm_goto_position,
|
||||
"@brief 'cm_goto_position' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_help_about", &lay::MainWindow::cm_help_about,
|
||||
"@brief 'cm_help_about' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_technologies", &lay::MainWindow::cm_technologies,
|
||||
"@brief 'cm_technologies' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.22."
|
||||
) +
|
||||
gsi::method ("cm_packages", &lay::MainWindow::cm_packages,
|
||||
"@brief 'cm_packages' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.25."
|
||||
) +
|
||||
gsi::method ("cm_open_too", &lay::MainWindow::cm_open_too,
|
||||
"@brief 'cm_open_too' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_open_new_view", &lay::MainWindow::cm_open_new_view,
|
||||
"@brief 'cm_open_new_view' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_open", &lay::MainWindow::cm_open,
|
||||
"@brief 'cm_open' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_pull_in", &lay::MainWindow::cm_pull_in,
|
||||
"@brief 'cm_pull_in' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_reader_options", &lay::MainWindow::cm_reader_options,
|
||||
"@brief 'cm_reader_options' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_new_layout", &lay::MainWindow::cm_new_layout,
|
||||
"@brief 'cm_new_layout' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_new_panel", &lay::MainWindow::cm_new_panel,
|
||||
"@brief 'cm_new_panel' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_adjust_origin", &lay::MainWindow::cm_adjust_origin,
|
||||
"@brief 'cm_adjust_origin' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_new_cell", &lay::MainWindow::cm_new_cell,
|
||||
"@brief 'cm_new_cell' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_new_layer", &lay::MainWindow::cm_new_layer,
|
||||
"@brief 'cm_new_layer' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_clear_layer", &lay::MainWindow::cm_clear_layer,
|
||||
"@brief 'cm_clear_layer' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_delete_layer", &lay::MainWindow::cm_delete_layer,
|
||||
"@brief 'cm_delete_layer' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_edit_layer", &lay::MainWindow::cm_edit_layer,
|
||||
"@brief 'cm_edit_layer' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_copy_layer", &lay::MainWindow::cm_copy_layer,
|
||||
"@brief 'cm_copy_layer' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.22."
|
||||
) +
|
||||
gsi::method ("cm_sel_flip_x", &lay::MainWindow::cm_sel_flip_x,
|
||||
"@brief 'cm_sel_flip_x' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_flip_y", &lay::MainWindow::cm_sel_flip_y,
|
||||
"@brief 'cm_sel_flip_y' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_rot_cw", &lay::MainWindow::cm_sel_rot_cw,
|
||||
"@brief 'cm_sel_rot_cw' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_rot_ccw", &lay::MainWindow::cm_sel_rot_ccw,
|
||||
"@brief 'cm_sel_rot_ccw' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_free_rot", &lay::MainWindow::cm_sel_free_rot,
|
||||
"@brief 'cm_sel_free_rot' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_scale", &lay::MainWindow::cm_sel_scale,
|
||||
"@brief 'cm_sel_scale' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_move", &lay::MainWindow::cm_sel_move,
|
||||
"@brief 'cm_sel_move' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_sel_move_to", &lay::MainWindow::cm_sel_move_to,
|
||||
"@brief 'cm_sel_move_to' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.24."
|
||||
) +
|
||||
gsi::method ("cm_lv_new_tab", &lay::MainWindow::cm_lv_new_tab,
|
||||
"@brief 'cm_lv_new_tab' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_remove_tab", &lay::MainWindow::cm_lv_remove_tab,
|
||||
"@brief 'cm_lv_remove_tab' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_rename_tab", &lay::MainWindow::cm_lv_rename_tab,
|
||||
"@brief 'cm_lv_rename_tab' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_hide", &lay::MainWindow::cm_lv_hide,
|
||||
"@brief 'cm_lv_hide' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_hide_all", &lay::MainWindow::cm_lv_hide_all,
|
||||
"@brief 'cm_lv_hide_all' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_show", &lay::MainWindow::cm_lv_show,
|
||||
"@brief 'cm_lv_show' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_show_all", &lay::MainWindow::cm_lv_show_all,
|
||||
"@brief 'cm_lv_show_all' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_show_only", &lay::MainWindow::cm_lv_show_only,
|
||||
"@brief 'cm_lv_show_only' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_lv_rename", &lay::MainWindow::cm_lv_rename,
|
||||
"@brief 'cm_lv_rename' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_select_all", &lay::MainWindow::cm_lv_select_all,
|
||||
"@brief 'cm_lv_select_all' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_delete", &lay::MainWindow::cm_lv_delete,
|
||||
"@brief 'cm_lv_delete' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_insert", &lay::MainWindow::cm_lv_insert,
|
||||
"@brief 'cm_lv_insert' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_group", &lay::MainWindow::cm_lv_group,
|
||||
"@brief 'cm_lv_group' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_ungroup", &lay::MainWindow::cm_lv_ungroup,
|
||||
"@brief 'cm_lv_ungroup' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_source", &lay::MainWindow::cm_lv_source,
|
||||
"@brief 'cm_lv_source' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_sort_by_name", &lay::MainWindow::cm_lv_sort_by_name,
|
||||
"@brief 'cm_lv_sort_by_name' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_sort_by_ild", &lay::MainWindow::cm_lv_sort_by_ild,
|
||||
"@brief 'cm_lv_sort_by_ild' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_sort_by_idl", &lay::MainWindow::cm_lv_sort_by_idl,
|
||||
"@brief 'cm_lv_sort_by_idl' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_sort_by_ldi", &lay::MainWindow::cm_lv_sort_by_ldi,
|
||||
"@brief 'cm_lv_sort_by_ldi' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_sort_by_dli", &lay::MainWindow::cm_lv_sort_by_dli,
|
||||
"@brief 'cm_lv_sort_by_dli' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_regroup_by_index", &lay::MainWindow::cm_lv_regroup_by_index,
|
||||
"@brief 'cm_lv_regroup_by_index' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_regroup_by_datatype", &lay::MainWindow::cm_lv_regroup_by_datatype,
|
||||
"@brief 'cm_lv_regroup_by_datatype' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_regroup_by_layer", &lay::MainWindow::cm_lv_regroup_by_layer,
|
||||
"@brief 'cm_lv_regroup_by_layer' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_regroup_flatten", &lay::MainWindow::cm_lv_regroup_flatten,
|
||||
"@brief 'cm_lv_regroup_flatten' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_expand_all", &lay::MainWindow::cm_lv_expand_all,
|
||||
"@brief 'cm_lv_expand_all' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_add_missing", &lay::MainWindow::cm_lv_add_missing,
|
||||
"@brief 'cm_lv_add_missing' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_lv_remove_unused", &lay::MainWindow::cm_lv_remove_unused,
|
||||
"@brief 'cm_lv_remove_unused' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cell_delete", &lay::MainWindow::cm_cell_delete,
|
||||
"@brief 'cm_cell_delete' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_cell_rename", &lay::MainWindow::cm_cell_rename,
|
||||
"@brief 'cm_cell_rename' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_cell_copy", &lay::MainWindow::cm_cell_copy,
|
||||
"@brief 'cm_cell_copy' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_cell_cut", &lay::MainWindow::cm_cell_cut,
|
||||
"@brief 'cm_cell_cut' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_cell_paste", &lay::MainWindow::cm_cell_paste,
|
||||
"@brief 'cm_cell_paste' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.20."
|
||||
) +
|
||||
gsi::method ("cm_cell_select", &lay::MainWindow::cm_cell_select,
|
||||
"@brief 'cm_cell_select' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_open_current_cell", &lay::MainWindow::cm_open_current_cell,
|
||||
"@brief 'cm_open_current_cell' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_save_current_cell_as", &lay::MainWindow::cm_save_current_cell_as,
|
||||
"@brief 'cm_save_current_cell_as' action (bound to a menu)"
|
||||
"\nThis method has been added in version 0.18."
|
||||
) +
|
||||
gsi::method ("cm_cell_hide", &lay::MainWindow::cm_cell_hide,
|
||||
"@brief 'cm_cell_hide' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cell_flatten", &lay::MainWindow::cm_cell_flatten,
|
||||
"@brief 'cm_cell_flatten' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cell_show", &lay::MainWindow::cm_cell_show,
|
||||
"@brief 'cm_cell_show' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_cell_show_all", &lay::MainWindow::cm_cell_show_all,
|
||||
"@brief 'cm_cell_show_all' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_navigator_close", &lay::MainWindow::cm_navigator_close,
|
||||
"@brief 'cm_navigator_close' action (bound to a menu)"
|
||||
) +
|
||||
gsi::method ("cm_navigator_freeze", &lay::MainWindow::cm_navigator_freeze,
|
||||
"@brief 'cm_navigator_freeze' action (bound to a menu)"
|
||||
),
|
||||
|
||||
"This method has been introduced in version 0.27."
|
||||
) +
|
||||
// backward compatibility (cm_... methods, deprecated)
|
||||
cm_method_decl<0> () +
|
||||
cm_method_decl<1> () +
|
||||
cm_method_decl<2> () +
|
||||
cm_method_decl<3> () +
|
||||
cm_method_decl<4> () +
|
||||
cm_method_decl<5> () +
|
||||
cm_method_decl<6> () +
|
||||
cm_method_decl<7> () +
|
||||
cm_method_decl<8> () +
|
||||
cm_method_decl<9> () +
|
||||
cm_method_decl<10> () +
|
||||
cm_method_decl<11> () +
|
||||
cm_method_decl<12> () +
|
||||
cm_method_decl<13> () +
|
||||
cm_method_decl<14> () +
|
||||
cm_method_decl<15> () +
|
||||
cm_method_decl<16> () +
|
||||
cm_method_decl<17> () +
|
||||
cm_method_decl<18> () +
|
||||
cm_method_decl<19> () +
|
||||
cm_method_decl<20> () +
|
||||
cm_method_decl<21> () +
|
||||
cm_method_decl<22> () +
|
||||
cm_method_decl<23> () +
|
||||
cm_method_decl<24> () +
|
||||
cm_method_decl<25> () +
|
||||
cm_method_decl<26> () +
|
||||
cm_method_decl<27> () +
|
||||
cm_method_decl<28> () +
|
||||
cm_method_decl<29> () +
|
||||
cm_method_decl<30> () +
|
||||
cm_method_decl<31> () +
|
||||
cm_method_decl<32> () +
|
||||
cm_method_decl<33> () +
|
||||
cm_method_decl<34> () +
|
||||
cm_method_decl<35> () +
|
||||
cm_method_decl<36> () +
|
||||
cm_method_decl<37> () +
|
||||
cm_method_decl<38> () +
|
||||
cm_method_decl<39> () +
|
||||
cm_method_decl<40> () +
|
||||
cm_method_decl<41> () +
|
||||
cm_method_decl<42> () +
|
||||
cm_method_decl<43> () +
|
||||
cm_method_decl<44> () +
|
||||
cm_method_decl<45> () +
|
||||
cm_method_decl<46> () +
|
||||
cm_method_decl<47> () +
|
||||
cm_method_decl<48> () +
|
||||
cm_method_decl<49> () +
|
||||
cm_method_decl<50> () +
|
||||
cm_method_decl<51> () +
|
||||
cm_method_decl<52> () +
|
||||
cm_method_decl<53> () +
|
||||
cm_method_decl<54> () +
|
||||
cm_method_decl<55> () +
|
||||
cm_method_decl<56> () +
|
||||
cm_method_decl<57> () +
|
||||
cm_method_decl<58> () +
|
||||
cm_method_decl<59> () +
|
||||
cm_method_decl<60> () +
|
||||
cm_method_decl<61> () +
|
||||
cm_method_decl<62> () +
|
||||
cm_method_decl<63> () +
|
||||
cm_method_decl<64> () +
|
||||
cm_method_decl<65> () +
|
||||
cm_method_decl<66> () +
|
||||
cm_method_decl<67> () +
|
||||
cm_method_decl<68> () +
|
||||
cm_method_decl<69> () +
|
||||
cm_method_decl<70> () +
|
||||
cm_method_decl<71> () +
|
||||
cm_method_decl<72> () +
|
||||
cm_method_decl<73> () +
|
||||
cm_method_decl<74> () +
|
||||
cm_method_decl<75> () +
|
||||
cm_method_decl<76> () +
|
||||
cm_method_decl<77> () +
|
||||
cm_method_decl<78> () +
|
||||
cm_method_decl<79> () +
|
||||
cm_method_decl<80> () +
|
||||
cm_method_decl<81> () +
|
||||
cm_method_decl<82> () +
|
||||
cm_method_decl<83> () +
|
||||
cm_method_decl<84> () +
|
||||
cm_method_decl<85> () +
|
||||
cm_method_decl<86> () +
|
||||
cm_method_decl<87> () +
|
||||
cm_method_decl<88> () +
|
||||
cm_method_decl<89> () +
|
||||
cm_method_decl<90> () +
|
||||
cm_method_decl<91> () +
|
||||
cm_method_decl<92> () +
|
||||
cm_method_decl<93> () +
|
||||
cm_method_decl<94> () +
|
||||
cm_method_decl<95> () +
|
||||
cm_method_decl<96> () +
|
||||
cm_method_decl<97> () +
|
||||
cm_method_decl<98> () +
|
||||
cm_method_decl<99> () +
|
||||
cm_method_decl<100> () +
|
||||
cm_method_decl<101> () +
|
||||
cm_method_decl<102> () +
|
||||
cm_method_decl<103> () +
|
||||
cm_method_decl<104> () +
|
||||
cm_method_decl<105> () +
|
||||
cm_method_decl<106> () +
|
||||
cm_method_decl<107> () +
|
||||
cm_method_decl<108> () +
|
||||
cm_method_decl<109> () +
|
||||
cm_method_decl<110> () +
|
||||
cm_method_decl<111> () +
|
||||
cm_method_decl<112> () +
|
||||
cm_method_decl<113> () +
|
||||
cm_method_decl<114> () +
|
||||
cm_method_decl<115> () +
|
||||
cm_method_decl<116> () +
|
||||
cm_method_decl<117> (),
|
||||
"@brief The main application window and central controller object\n"
|
||||
"\n"
|
||||
"This object first is the main window but also the main controller. The main controller "
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ HEADERS = \
|
|||
layHelpDialog.h \
|
||||
layHelpProvider.h \
|
||||
layHelpSource.h \
|
||||
layLayoutStatisticsForm.h \
|
||||
layLogViewerDialog.h \
|
||||
layMacroEditorDialog.h \
|
||||
layMacroEditorPage.h \
|
||||
|
|
@ -32,7 +31,6 @@ HEADERS = \
|
|||
laySearchReplaceConfigPage.h \
|
||||
laySearchReplaceDialog.h \
|
||||
laySearchReplacePropertiesWidgets.h \
|
||||
laySelectCellViewForm.h \
|
||||
laySession.h \
|
||||
laySettingsForm.h \
|
||||
layTechSetupDialog.h \
|
||||
|
|
@ -68,7 +66,6 @@ FORMS = \
|
|||
DeleteModeDialog.ui \
|
||||
FillDialog.ui \
|
||||
HelpAboutDialog.ui \
|
||||
LayoutStatistics.ui \
|
||||
LogViewerDialog.ui \
|
||||
MacroEditorDialog.ui \
|
||||
MacroPropertiesDialog.ui \
|
||||
|
|
@ -122,7 +119,6 @@ SOURCES = \
|
|||
layHelpDialog.cc \
|
||||
layHelpProvider.cc \
|
||||
layHelpSource.cc \
|
||||
layLayoutStatisticsForm.cc \
|
||||
layLogViewerDialog.cc \
|
||||
layMacroEditorDialog.cc \
|
||||
layMacroEditorPage.cc \
|
||||
|
|
|
|||
|
|
@ -1483,7 +1483,7 @@ GuiApplication::setup ()
|
|||
{
|
||||
tl_assert (mp_mw == 0 && mp_plugin_root == 0);
|
||||
|
||||
mp_plugin_root = new lay::PluginRootToMainWindow ();
|
||||
mp_plugin_root = new lay::DispatcherToMainWindow ();
|
||||
mp_mw = new lay::MainWindow (this, mp_plugin_root, "main_window", is_undo_enabled ());
|
||||
mp_plugin_root->attach_to (mp_mw);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace lay
|
|||
{
|
||||
|
||||
class MainWindow;
|
||||
class PluginRootToMainWindow;
|
||||
class DispatcherToMainWindow;
|
||||
class PluginRoot;
|
||||
class ProgressReporter;
|
||||
class ProgressBar;
|
||||
|
|
@ -445,7 +445,7 @@ protected:
|
|||
|
||||
private:
|
||||
MainWindow *mp_mw;
|
||||
PluginRootToMainWindow *mp_plugin_root;
|
||||
DispatcherToMainWindow *mp_plugin_root;
|
||||
gtf::Recorder *mp_recorder;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -89,12 +89,12 @@ public:
|
|||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual void initialized (lay::PluginRoot *root);
|
||||
virtual void initialized (lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual void uninitialize (lay::PluginRoot *root);
|
||||
virtual void uninitialize (lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
|
|
@ -109,7 +109,7 @@ public:
|
|||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual bool can_exit (lay::PluginRoot *root) const;
|
||||
virtual bool can_exit (lay::Dispatcher *root) const;
|
||||
|
||||
/**
|
||||
* @brief Gets a value indicating whether the plugin will accept a dropped file with the given URL or path
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public:
|
|||
MainConfigPage (QWidget *parent);
|
||||
~MainConfigPage ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage *mp_ui;
|
||||
|
|
@ -75,8 +75,8 @@ public:
|
|||
MainConfigPage2 (QWidget *parent);
|
||||
~MainConfigPage2 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage2 *mp_ui;
|
||||
|
|
@ -91,8 +91,8 @@ public:
|
|||
MainConfigPage3 (QWidget *parent);
|
||||
~MainConfigPage3 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage3 *mp_ui;
|
||||
|
|
@ -107,8 +107,8 @@ public:
|
|||
MainConfigPage4 (QWidget *parent);
|
||||
~MainConfigPage4 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage4 *mp_ui;
|
||||
|
|
@ -123,8 +123,8 @@ public:
|
|||
MainConfigPage5 (QWidget *parent);
|
||||
~MainConfigPage5 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage5 *mp_ui;
|
||||
|
|
@ -139,8 +139,8 @@ public:
|
|||
MainConfigPage6 (QWidget *parent);
|
||||
~MainConfigPage6 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage6 *mp_ui;
|
||||
|
|
@ -155,8 +155,8 @@ public:
|
|||
MainConfigPage7 (QWidget *parent);
|
||||
~MainConfigPage7 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::MainConfigPage7 *mp_ui;
|
||||
|
|
@ -171,8 +171,8 @@ public:
|
|||
CustomizeMenuConfigPage (QWidget *parent);
|
||||
~CustomizeMenuConfigPage ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private slots:
|
||||
void current_changed (QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -40,7 +40,7 @@
|
|||
#include "dbManager.h"
|
||||
#include "dbLoadLayoutOptions.h"
|
||||
#include "layAbstractMenu.h"
|
||||
#include "layAbstractMenuProvider.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layPlugin.h"
|
||||
#include "layProgress.h"
|
||||
|
|
@ -118,8 +118,7 @@ private:
|
|||
|
||||
class LAY_PUBLIC MainWindow
|
||||
: public QMainWindow,
|
||||
public lay::Plugin,
|
||||
public lay::AbstractMenuProvider
|
||||
public lay::Dispatcher
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
@ -140,21 +139,13 @@ public:
|
|||
~MainWindow ();
|
||||
|
||||
/**
|
||||
* @brief Implementation of the AbstractMenuProvider interface
|
||||
* @brief Implementation of the Dispatcher interface
|
||||
*/
|
||||
QWidget *menu_parent_widget ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the main menu abstraction object
|
||||
*/
|
||||
AbstractMenu *menu ()
|
||||
{
|
||||
return mp_menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shows the window
|
||||
*
|
||||
|
|
@ -407,12 +398,12 @@ public:
|
|||
bool show_progress_bar (bool show);
|
||||
|
||||
/**
|
||||
* @brief Implementation of the PluginRoot interface
|
||||
* @brief Implementation of the Plugin interface
|
||||
*/
|
||||
bool configure (const std::string &name, const std::string &value);
|
||||
|
||||
/**
|
||||
* @brief Implementation of the PluginRoot interface
|
||||
* @brief Implementation of the Plugin interface
|
||||
*/
|
||||
void config_finalize ();
|
||||
|
||||
|
|
@ -536,6 +527,11 @@ public:
|
|||
*/
|
||||
void menu_activated (const std::string &symbol);
|
||||
|
||||
/**
|
||||
* @brief Gets the available menu symbols
|
||||
*/
|
||||
static std::vector<std::string> menu_symbols ();
|
||||
|
||||
/**
|
||||
* @brief Get the action for a slot
|
||||
*/
|
||||
|
|
@ -664,11 +660,6 @@ public slots:
|
|||
*/
|
||||
void select_mode (int m);
|
||||
|
||||
/**
|
||||
* @brief Called when one of the built-in modes (i.e. select, move) is selected
|
||||
*/
|
||||
void intrinsic_mode_triggered ();
|
||||
|
||||
void update_action_states ();
|
||||
void cancel ();
|
||||
void redraw ();
|
||||
|
|
@ -681,157 +672,6 @@ public slots:
|
|||
void view_selected (int index);
|
||||
void view_title_changed ();
|
||||
|
||||
// menu callbacks for main window
|
||||
void cm_reset_window_state ();
|
||||
void cm_select_all ();
|
||||
void cm_unselect_all ();
|
||||
void cm_undo ();
|
||||
void cm_redo ();
|
||||
void cm_delete ();
|
||||
void cm_show_properties ();
|
||||
void cm_copy ();
|
||||
void cm_paste ();
|
||||
void cm_paste_interactive ();
|
||||
void cm_duplicate ();
|
||||
void cm_duplicate_interactive ();
|
||||
void cm_cut ();
|
||||
void cm_zoom_fit_sel ();
|
||||
void cm_zoom_fit ();
|
||||
void cm_zoom_in ();
|
||||
void cm_zoom_out ();
|
||||
void cm_pan_up ();
|
||||
void cm_pan_down ();
|
||||
void cm_pan_left ();
|
||||
void cm_pan_right ();
|
||||
void cm_save_session ();
|
||||
void cm_restore_session ();
|
||||
void cm_setup ();
|
||||
void cm_save_as ();
|
||||
void cm_save_all ();
|
||||
void cm_save ();
|
||||
void cm_reload ();
|
||||
void cm_close ();
|
||||
void cm_close_all ();
|
||||
void cm_clone ();
|
||||
void cm_layout_props ();
|
||||
void cm_layout_stats ();
|
||||
void cm_inc_max_hier ();
|
||||
void cm_dec_max_hier ();
|
||||
void cm_max_hier ();
|
||||
void cm_max_hier_0 ();
|
||||
void cm_max_hier_1 ();
|
||||
void cm_prev_display_state ();
|
||||
void cm_next_display_state ();
|
||||
void cm_cancel ();
|
||||
void cm_redraw ();
|
||||
void cm_screenshot ();
|
||||
void cm_save_layer_props ();
|
||||
void cm_load_layer_props ();
|
||||
void cm_save_bookmarks ();
|
||||
void cm_load_bookmarks ();
|
||||
void cm_select_cell ();
|
||||
void cm_select_current_cell ();
|
||||
void cm_print ();
|
||||
void cm_exit ();
|
||||
void cm_view_log ();
|
||||
void cm_bookmark_view ();
|
||||
void cm_manage_bookmarks ();
|
||||
void cm_goto_position ();
|
||||
void cm_show_all_tips ();
|
||||
void cm_help_about ();
|
||||
void cm_help_about_qt ();
|
||||
void cm_macro_editor ();
|
||||
void cm_packages ();
|
||||
void cm_technologies ();
|
||||
void cm_open_too ();
|
||||
void cm_open_new_view ();
|
||||
void cm_open ();
|
||||
void cm_pull_in ();
|
||||
void cm_reader_options ();
|
||||
void cm_writer_options ();
|
||||
void cm_new_layout ();
|
||||
void cm_new_panel ();
|
||||
void cm_adjust_origin ();
|
||||
void cm_new_cell ();
|
||||
void cm_new_layer ();
|
||||
void cm_clear_layer ();
|
||||
void cm_delete_layer ();
|
||||
void cm_edit_layer ();
|
||||
void cm_copy_layer ();
|
||||
void cm_lay_convert_to_static ();
|
||||
void cm_lay_flip_x ();
|
||||
void cm_lay_flip_y ();
|
||||
void cm_lay_rot_cw ();
|
||||
void cm_lay_rot_ccw ();
|
||||
void cm_lay_free_rot ();
|
||||
void cm_lay_scale ();
|
||||
void cm_lay_move ();
|
||||
void cm_sel_flip_x ();
|
||||
void cm_sel_flip_y ();
|
||||
void cm_sel_rot_cw ();
|
||||
void cm_sel_rot_ccw ();
|
||||
void cm_sel_free_rot ();
|
||||
void cm_sel_scale ();
|
||||
void cm_sel_move ();
|
||||
void cm_sel_move_to ();
|
||||
void cm_sel_move_interactive ();
|
||||
void cm_show_assistant ();
|
||||
|
||||
// forwarded to the current view: layer list context menu
|
||||
void cm_lv_new_tab ();
|
||||
void cm_lv_remove_tab ();
|
||||
void cm_lv_rename_tab ();
|
||||
void cm_lv_make_valid ();
|
||||
void cm_lv_make_invalid ();
|
||||
void cm_lv_hide ();
|
||||
void cm_lv_hide_all ();
|
||||
void cm_lv_show ();
|
||||
void cm_lv_show_all ();
|
||||
void cm_lv_show_only ();
|
||||
void cm_lv_rename ();
|
||||
void cm_lv_select_all ();
|
||||
void cm_lv_delete ();
|
||||
void cm_lv_insert ();
|
||||
void cm_lv_group ();
|
||||
void cm_lv_ungroup ();
|
||||
void cm_lv_source ();
|
||||
void cm_lv_sort_by_name ();
|
||||
void cm_lv_sort_by_ild ();
|
||||
void cm_lv_sort_by_idl ();
|
||||
void cm_lv_sort_by_ldi ();
|
||||
void cm_lv_sort_by_dli ();
|
||||
void cm_lv_regroup_by_index ();
|
||||
void cm_lv_regroup_by_datatype ();
|
||||
void cm_lv_regroup_by_layer ();
|
||||
void cm_lv_regroup_flatten ();
|
||||
void cm_lv_expand_all ();
|
||||
void cm_lv_add_missing ();
|
||||
void cm_lv_remove_unused ();
|
||||
void cm_lv_copy ();
|
||||
void cm_lv_cut ();
|
||||
void cm_lv_paste ();
|
||||
|
||||
// forwarded to the current view: cell list context menu
|
||||
void cm_cell_user_properties ();
|
||||
void cm_cell_delete ();
|
||||
void cm_cell_replace ();
|
||||
void cm_cell_rename ();
|
||||
void cm_cell_flatten ();
|
||||
void cm_cell_convert_to_static ();
|
||||
void cm_cell_copy ();
|
||||
void cm_cell_cut ();
|
||||
void cm_cell_paste ();
|
||||
void cm_cell_select ();
|
||||
void cm_open_current_cell ();
|
||||
void cm_save_current_cell_as ();
|
||||
void cm_cell_hide ();
|
||||
void cm_cell_show ();
|
||||
void cm_cell_show_all ();
|
||||
|
||||
// forwarded to the navigator
|
||||
void cm_navigator_freeze ();
|
||||
void cm_navigator_close ();
|
||||
|
||||
/**
|
||||
* @brief shows the given URL as a non-modal help window
|
||||
* Intended as a connection target for QLabel linkVisisted signals.
|
||||
|
|
@ -865,12 +705,11 @@ protected:
|
|||
void do_update_file_menu ();
|
||||
|
||||
private:
|
||||
friend class PluginRootToMainWindow;
|
||||
friend class DispatcherToMainWindow;
|
||||
|
||||
TextProgressDelegate m_text_progress;
|
||||
|
||||
// Main menu
|
||||
AbstractMenu *mp_menu;
|
||||
QTabBar *mp_tab_bar;
|
||||
QToolBar *mp_tool_bar;
|
||||
QDockWidget *mp_navigator_dock_widget;
|
||||
|
|
@ -922,9 +761,7 @@ private:
|
|||
bool m_default_grids_updated;
|
||||
std::vector<lay::Action *> m_default_grid_actions;
|
||||
std::vector<std::pair<std::string, std::string> > m_key_bindings;
|
||||
double m_new_cell_window_size;
|
||||
bool m_new_layout_current_panel;
|
||||
std::string m_new_cell_cell_name;
|
||||
bool m_synchronized_views;
|
||||
bool m_synchronous;
|
||||
bool m_busy;
|
||||
|
|
@ -935,10 +772,6 @@ private:
|
|||
std::auto_ptr<QPrinter> mp_printer;
|
||||
std::vector<QString> m_changed_files;
|
||||
|
||||
std::map<std::string, lay::Action> m_actions_for_slot;
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> > m_configuration_actions;
|
||||
tl::shared_collection<lay::ConfigureAction> m_ca_collection;
|
||||
|
||||
// the object manager (undo/redo mechanism and others)
|
||||
db::Manager m_manager;
|
||||
|
||||
|
|
@ -949,8 +782,48 @@ private:
|
|||
void closeEvent (QCloseEvent *event);
|
||||
void resizeEvent (QResizeEvent *event);
|
||||
|
||||
void do_cm_paste (bool interactive);
|
||||
void do_cm_duplicate (bool interactive);
|
||||
void cm_navigator_freeze ();
|
||||
void cm_navigator_close ();
|
||||
void cm_view_log ();
|
||||
void cm_print ();
|
||||
void cm_exit ();
|
||||
void cm_reset_window_state ();
|
||||
void cm_undo ();
|
||||
void cm_redo ();
|
||||
void cm_goto_position ();
|
||||
void cm_manage_bookmarks ();
|
||||
void cm_bookmark_view ();
|
||||
void cm_cancel ();
|
||||
void cm_save_layer_props ();
|
||||
void cm_load_layer_props ();
|
||||
void cm_save_session ();
|
||||
void cm_restore_session ();
|
||||
void cm_save_bookmarks ();
|
||||
void cm_load_bookmarks ();
|
||||
void cm_screenshot ();
|
||||
void cm_save_current_cell_as ();
|
||||
void cm_save ();
|
||||
void cm_save_as ();
|
||||
void cm_save_all ();
|
||||
void cm_setup ();
|
||||
void cm_open_too ();
|
||||
void cm_open_new_view ();
|
||||
void cm_open ();
|
||||
void cm_pull_in ();
|
||||
void cm_reader_options ();
|
||||
void cm_writer_options ();
|
||||
void cm_new_panel ();
|
||||
void cm_new_layout ();
|
||||
void cm_clone ();
|
||||
void cm_close_all ();
|
||||
void cm_close ();
|
||||
void cm_packages ();
|
||||
void cm_technologies ();
|
||||
void cm_macro_editor ();
|
||||
void cm_show_assistant ();
|
||||
void cm_show_all_tips ();
|
||||
void cm_help_about ();
|
||||
void cm_help_about_qt ();
|
||||
|
||||
void format_message ();
|
||||
|
||||
|
|
@ -982,11 +855,11 @@ private:
|
|||
void apply_hidden (const std::vector<std::pair <std::string, bool> > &hidden);
|
||||
};
|
||||
|
||||
class LAY_PUBLIC PluginRootToMainWindow
|
||||
: public lay::PluginRoot
|
||||
class LAY_PUBLIC DispatcherToMainWindow
|
||||
: public lay::Dispatcher
|
||||
{
|
||||
public:
|
||||
PluginRootToMainWindow ();
|
||||
DispatcherToMainWindow ();
|
||||
|
||||
void attach_to (lay::MainWindow *main_window);
|
||||
|
||||
|
|
@ -996,8 +869,8 @@ public:
|
|||
virtual void menu_activated (const std::string &symbol);
|
||||
|
||||
private:
|
||||
PluginRootToMainWindow (const PluginRootToMainWindow &);
|
||||
PluginRootToMainWindow &operator= (const PluginRootToMainWindow &);
|
||||
DispatcherToMainWindow (const DispatcherToMainWindow &);
|
||||
DispatcherToMainWindow &operator= (const DispatcherToMainWindow &);
|
||||
|
||||
tl::weak_ptr<MainWindow> mp_main_window;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -503,32 +503,6 @@ Navigator::~Navigator ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::init_menu (AbstractMenu &menu)
|
||||
{
|
||||
MenuLayoutEntry navigator_main_menu [] = {
|
||||
MenuLayoutEntry ("navigator_show_images", tl::to_string (QObject::tr ("Show Images")), std::make_pair (cfg_navigator_show_images, "?")),
|
||||
MenuLayoutEntry ("navigator_all_hier_levels", tl::to_string (QObject::tr ("Show All Hierarchy Levels")), std::make_pair (cfg_navigator_all_hier_levels, "?")),
|
||||
MenuLayoutEntry::separator ("navigator_options_group"),
|
||||
MenuLayoutEntry ("navigator_freeze", tl::to_string (QObject::tr ("Freeze")), SLOT (cm_navigator_freeze ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry navigator_menu [] = {
|
||||
MenuLayoutEntry ("navigator_main_menu", tl::to_string (QObject::tr ("Options")), navigator_main_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry navigator_detached_menu [] = {
|
||||
MenuLayoutEntry ("@@navigator_menu", "", navigator_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (navigator_detached_menu);
|
||||
|
||||
menu.action (freeze_action_path).set_checkable (true);
|
||||
}
|
||||
|
||||
void
|
||||
Navigator::menu_changed ()
|
||||
{
|
||||
|
|
@ -598,8 +572,8 @@ Navigator::showEvent (QShowEvent *)
|
|||
void
|
||||
Navigator::closeEvent (QCloseEvent *)
|
||||
{
|
||||
lay::PluginRoot::instance ()->config_set (cfg_show_navigator, "false");
|
||||
lay::PluginRoot::instance ()->config_end ();
|
||||
mp_main_window->config_set (cfg_show_navigator, "false");
|
||||
mp_main_window->config_end ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -793,5 +767,33 @@ Navigator::update ()
|
|||
mp_service->update_marker ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class NavigatorPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@@navigator_menu", at, std::string ()));
|
||||
|
||||
at = "@@navigator_menu.end";
|
||||
menu_entries.push_back (lay::submenu ("navigator_main_menu", at, tl::to_string (QObject::tr ("Options"))));
|
||||
|
||||
at = "@@navigator_menu.navigator_main_menu.end";
|
||||
menu_entries.push_back (lay::config_menu_item ("navigator_show_images", at, tl::to_string (QObject::tr ("Show Images")), cfg_navigator_show_images, "?"));
|
||||
menu_entries.push_back (lay::config_menu_item ("navigator_all_hier_levels", at, tl::to_string (QObject::tr ("Show All Hierarchy Levels")), cfg_navigator_all_hier_levels, "?"));
|
||||
menu_entries.push_back (lay::separator ("navigator_options_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_navigator_freeze", "navigator_freeze", at, tl::to_string (QObject::tr ("Freeze"))));
|
||||
menu_entries.back ().checkable = true;
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new NavigatorPluginDeclaration (), -1, "NavigatorPlugin");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ public:
|
|||
void all_hier_levels (bool f);
|
||||
void show_images (bool f);
|
||||
|
||||
static void init_menu (AbstractMenu &menu);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent (QCloseEvent *event);
|
||||
virtual void showEvent (QShowEvent *event);
|
||||
|
|
|
|||
|
|
@ -69,17 +69,17 @@ public:
|
|||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual void initialize (lay::PluginRoot *root);
|
||||
virtual void initialize (lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual void initialized (lay::PluginRoot *root);
|
||||
virtual void initialized (lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
virtual void uninitialize (lay::PluginRoot *root);
|
||||
virtual void uninitialize (lay::Dispatcher *root);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
|
|
@ -104,7 +104,7 @@ public:
|
|||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
*/
|
||||
bool can_exit (lay::PluginRoot *root) const;
|
||||
bool can_exit (lay::Dispatcher *root) const;
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of the PluginDeclaration interface
|
||||
|
|
@ -191,7 +191,7 @@ signals:
|
|||
private:
|
||||
lay::SaltManagerDialog *mp_salt_dialog;
|
||||
lay::MainWindow *mp_mw;
|
||||
lay::PluginRoot * mp_plugin_root;
|
||||
lay::Dispatcher * mp_plugin_root;
|
||||
std::string m_salt_mine_url;
|
||||
lay::Salt m_salt;
|
||||
tl::FileSystemWatcher *m_file_watcher;
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ namespace lay
|
|||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
SettingsForm::SettingsForm (QWidget *parent, lay::PluginRoot *plugin_root, const char *name)
|
||||
SettingsForm::SettingsForm (QWidget *parent, lay::Dispatcher *dispatcher, const char *name)
|
||||
: QDialog (parent), Ui::SettingsForm (),
|
||||
mp_plugin_root (plugin_root), m_finalize_recursion (false)
|
||||
mp_plugin_root (dispatcher), m_finalize_recursion (false)
|
||||
{
|
||||
setObjectName (QString::fromUtf8 (name));
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
namespace lay
|
||||
{
|
||||
|
||||
class PluginRoot;
|
||||
class Dispatcher;
|
||||
class ConfigPage;
|
||||
|
||||
class SettingsForm
|
||||
|
|
@ -46,7 +46,7 @@ class SettingsForm
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsForm (QWidget *parent, lay::PluginRoot *plugin_root, const char *name);
|
||||
SettingsForm (QWidget *parent, lay::Dispatcher *dispatcher, const char *name);
|
||||
|
||||
void setup ();
|
||||
void commit ();
|
||||
|
|
@ -58,7 +58,7 @@ public slots:
|
|||
void item_changed (QTreeWidgetItem *, QTreeWidgetItem *);
|
||||
|
||||
private:
|
||||
lay::PluginRoot *mp_plugin_root;
|
||||
lay::Dispatcher *mp_dispatcher;
|
||||
std::vector <lay::ConfigPage *> m_config_pages;
|
||||
bool m_finalize_recursion;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ public:
|
|||
*/
|
||||
TechnologyController ();
|
||||
|
||||
void initialize (lay::PluginRoot *root);
|
||||
void initialized (lay::PluginRoot *root);
|
||||
void uninitialize (lay::PluginRoot *root);
|
||||
void initialize (lay::Dispatcher *root);
|
||||
void initialized (lay::Dispatcher *root);
|
||||
void uninitialize (lay::Dispatcher *root);
|
||||
|
||||
void get_options (std::vector < std::pair<std::string, std::string> > &options) const;
|
||||
void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const;
|
||||
|
|
@ -132,7 +132,7 @@ private:
|
|||
bool m_technologies_configured;
|
||||
lay::TechSetupDialog *mp_editor;
|
||||
lay::MainWindow *mp_mw;
|
||||
lay::PluginRoot *mp_plugin_root;
|
||||
lay::Dispatcher *mp_plugin_root;
|
||||
std::vector<std::string> m_paths;
|
||||
std::vector<db::Technology> m_temp_tech;
|
||||
db::Technology *mp_active_technology;
|
||||
|
|
|
|||
|
|
@ -533,6 +533,18 @@ Class<lay::LayoutView> decl_LayoutView (QT_EXTERNAL_BASE (QWidget) "lay", "Layou
|
|||
"This method has been introduced in version 0.27\n"
|
||||
) +
|
||||
#endif
|
||||
gsi::method ("call_menu", &lay::LayoutView::menu_activated,
|
||||
"@brief Calls the menu item with the provided symbol.\n"
|
||||
"To obtain all symbols, use get_menu_symbols.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.27."
|
||||
) +
|
||||
gsi::method ("get_menu_symbols", &lay::LayoutView::get_menu_symbols,
|
||||
"@brief Calls the menu item with the provided symbol.\n"
|
||||
"To obtain all available symbols, use get_menu_symbols.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.27."
|
||||
) +
|
||||
gsi::method ("current", &lay::LayoutView::current,
|
||||
"@brief Returns the current view\n"
|
||||
"The current view is the one that is shown in the current tab. Returns nil if no layout is loaded.\n"
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ namespace gsi
|
|||
// of the factory, this hack is a quick but dirty workaround.
|
||||
static bool s_in_create_plugin = false;
|
||||
static lay::LayoutView *sp_view = 0;
|
||||
static lay::PluginRoot *sp_root = 0;
|
||||
static lay::Dispatcher *sp_dispatcher = 0;
|
||||
|
||||
class PluginBase
|
||||
: public lay::Plugin, public lay::ViewService
|
||||
{
|
||||
public:
|
||||
PluginBase ()
|
||||
: lay::Plugin (sp_root), lay::ViewService (sp_view ? sp_view->view_object_widget () : 0)
|
||||
: lay::Plugin (sp_dispatcher), lay::ViewService (sp_view ? sp_view->view_object_widget () : 0)
|
||||
{
|
||||
if (! s_in_create_plugin) {
|
||||
throw tl::Exception (tl::to_string (QObject::tr ("A PluginBase object can only be created in the PluginFactory's create_plugin method")));
|
||||
|
|
@ -334,7 +334,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void initialize (lay::PluginRoot *root)
|
||||
virtual void initialize (lay::Dispatcher *root)
|
||||
{
|
||||
if (f_initialize.can_issue ()) {
|
||||
f_initialize.issue<lay::PluginDeclaration> (&lay::PluginDeclaration::initialize, root);
|
||||
|
|
@ -343,7 +343,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void uninitialize (lay::PluginRoot *root)
|
||||
virtual void uninitialize (lay::Dispatcher *root)
|
||||
{
|
||||
if (f_uninitialize.can_issue ()) {
|
||||
f_uninitialize.issue<lay::PluginDeclaration> (&lay::PluginDeclaration::uninitialize, root);
|
||||
|
|
@ -352,7 +352,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::PluginRoot *root, lay::LayoutView *view) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
{
|
||||
if (f_create_plugin.can_issue ()) {
|
||||
return create_plugin_gsi (manager, root, view);
|
||||
|
|
@ -361,22 +361,22 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual gsi::PluginBase *create_plugin_gsi (db::Manager *manager, lay::PluginRoot *root, lay::LayoutView *view) const
|
||||
virtual gsi::PluginBase *create_plugin_gsi (db::Manager *manager, lay::Dispatcher *root, lay::LayoutView *view) const
|
||||
{
|
||||
// TODO: this is a hack. See notes above at s_in_create_plugin
|
||||
s_in_create_plugin = true;
|
||||
sp_view = view;
|
||||
sp_root = root;
|
||||
sp_dispatcher = root;
|
||||
gsi::PluginBase *ret = 0;
|
||||
try {
|
||||
ret = f_create_plugin.issue<PluginFactoryBase, gsi::PluginBase *, db::Manager *, lay::PluginRoot *, lay::LayoutView *> (&PluginFactoryBase::create_plugin_gsi, manager, root, view);
|
||||
ret = f_create_plugin.issue<PluginFactoryBase, gsi::PluginBase *, db::Manager *, lay::Dispatcher *, lay::LayoutView *> (&PluginFactoryBase::create_plugin_gsi, manager, root, view);
|
||||
s_in_create_plugin = false;
|
||||
sp_view = 0;
|
||||
sp_root = 0;
|
||||
sp_dispatcher = 0;
|
||||
} catch (...) {
|
||||
s_in_create_plugin = false;
|
||||
sp_view = 0;
|
||||
sp_root = 0;
|
||||
sp_dispatcher = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -394,17 +394,31 @@ public:
|
|||
|
||||
void add_menu_entry1 (const std::string &menu_name, const std::string &insert_pos)
|
||||
{
|
||||
m_menu_entries.push_back (lay::MenuEntry (menu_name, insert_pos));
|
||||
m_menu_entries.push_back (lay::separator (menu_name, insert_pos));
|
||||
}
|
||||
|
||||
void add_menu_entry2 (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||
{
|
||||
m_menu_entries.push_back (lay::MenuEntry (symbol, menu_name, insert_pos, title));
|
||||
m_menu_entries.push_back (lay::menu_item (symbol, menu_name, insert_pos, title));
|
||||
}
|
||||
|
||||
void add_submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||
{
|
||||
m_menu_entries.push_back (lay::submenu (menu_name, insert_pos, title));
|
||||
}
|
||||
|
||||
void add_config_menu_item (const std::string &menu_name, const std::string &insert_pos, const std::string &title, const std::string &cname, const std::string &cvalue)
|
||||
{
|
||||
m_menu_entries.push_back (lay::config_menu_item (menu_name, insert_pos, title, cname, cvalue));
|
||||
}
|
||||
|
||||
void add_menu_entry3 (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title, bool sub_menu)
|
||||
{
|
||||
m_menu_entries.push_back (lay::MenuEntry (symbol, menu_name, insert_pos, title, sub_menu));
|
||||
if (sub_menu) {
|
||||
m_menu_entries.push_back (lay::submenu (symbol, menu_name, insert_pos, title));
|
||||
} else {
|
||||
m_menu_entries.push_back (lay::menu_item (symbol, menu_name, insert_pos, title));
|
||||
}
|
||||
}
|
||||
|
||||
void add_option (const std::string &name, const std::string &default_value)
|
||||
|
|
@ -439,9 +453,8 @@ private:
|
|||
};
|
||||
|
||||
Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
||||
method ("register", &PluginFactoryBase::register_gsi,
|
||||
method ("register", &PluginFactoryBase::register_gsi, gsi::arg ("position"), gsi::arg ("name"), gsi::arg ("title"),
|
||||
"@brief Registers the plugin factory\n"
|
||||
"@args position, name, title\n"
|
||||
"@param position An integer that determines the order in which the plugins are created. The internal plugins use the values from 1000 to 50000.\n"
|
||||
"@param name The plugin name. This is an arbitrary string which should be unique. Hence it is recommended to use a unique prefix, i.e. \"myplugin::ThePluginClass\".\n"
|
||||
"@param title The title string which is supposed to appear in the tool bar and menu related to this plugin.\n"
|
||||
|
|
@ -449,9 +462,8 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
"Registration of the plugin factory makes the object known to the system. Registration requires that the menu items have been set "
|
||||
"already. Hence it is recommended to put the registration at the end of the initialization method of the factory class.\n"
|
||||
) +
|
||||
method ("register", &PluginFactoryBase::register_gsi2,
|
||||
method ("register", &PluginFactoryBase::register_gsi2, gsi::arg ("position"), gsi::arg ("name"), gsi::arg ("title"), gsi::arg ("icon"),
|
||||
"@brief Registers the plugin factory\n"
|
||||
"@args position, name, title, icon\n"
|
||||
"@param position An integer that determines the order in which the plugins are created. The internal plugins use the values from 1000 to 50000.\n"
|
||||
"@param name The plugin name. This is an arbitrary string which should be unique. Hence it is recommended to use a unique prefix, i.e. \"myplugin::ThePluginClass\".\n"
|
||||
"@param title The title string which is supposed to appear in the tool bar and menu related to this plugin.\n"
|
||||
|
|
@ -462,9 +474,8 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
"Registration of the plugin factory makes the object known to the system. Registration requires that the menu items have been set "
|
||||
"already. Hence it is recommended to put the registration at the end of the initialization method of the factory class.\n"
|
||||
) +
|
||||
callback ("configure", &gsi::PluginFactoryBase::configure, &gsi::PluginFactoryBase::f_configure,
|
||||
callback ("configure", &gsi::PluginFactoryBase::configure, &gsi::PluginFactoryBase::f_configure, gsi::arg ("name"), gsi::arg ("value"),
|
||||
"@brief Gets called for configuration events for the plugin singleton\n"
|
||||
"@args name, value\n"
|
||||
"This method can be reimplemented to receive configuration events "
|
||||
"for the plugin singleton. Before a configuration can be received it must be "
|
||||
"registered by calling \\add_option in the plugin factories' constructor.\n"
|
||||
|
|
@ -479,14 +490,12 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
) +
|
||||
callback ("config_finalize", &gsi::PluginFactoryBase::config_finalize, &gsi::PluginFactoryBase::f_config_finalize,
|
||||
"@brief Gets called after a set of configuration events has been sent\n"
|
||||
"@args\n"
|
||||
"This method can be reimplemented and is called after a set of configuration events "
|
||||
"has been sent to the plugin factory singleton with \\configure. It can be used to "
|
||||
"set up user interfaces properly for example.\n"
|
||||
) +
|
||||
callback ("menu_activated", &gsi::PluginFactoryBase::menu_activated, &gsi::PluginFactoryBase::f_menu_activated,
|
||||
callback ("menu_activated", &gsi::PluginFactoryBase::menu_activated, &gsi::PluginFactoryBase::f_menu_activated, gsi::arg ("symbol"),
|
||||
"@brief Gets called when a menu item is selected\n"
|
||||
"@args symbol\n"
|
||||
"\n"
|
||||
"Usually, menu-triggered functionality is implemented in the per-view instance of the plugin. "
|
||||
"However, using this method it is possible to implement functionality globally for all plugin "
|
||||
|
|
@ -496,37 +505,32 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
"If this method was handling the menu event, it should return true. This indicates that the event "
|
||||
"will not be propagated to other plugins hence avoiding duplicate calls.\n"
|
||||
) +
|
||||
callback ("initialized", &gsi::PluginFactoryBase::initialize, &gsi::PluginFactoryBase::f_initialize,
|
||||
callback ("initialized", &gsi::PluginFactoryBase::initialize, &gsi::PluginFactoryBase::f_initialize, gsi::arg ("dispatcher"),
|
||||
"@brief Gets called when the plugin singleton is initialized, i.e. when the application has been started.\n"
|
||||
"@args root\n"
|
||||
"@param root The reference to the \\MainWindow object\n"
|
||||
"@param dispatcher The reference to the \\MainWindow object\n"
|
||||
) +
|
||||
callback ("uninitialized", &gsi::PluginFactoryBase::uninitialize, &gsi::PluginFactoryBase::f_uninitialize,
|
||||
callback ("uninitialized", &gsi::PluginFactoryBase::uninitialize, &gsi::PluginFactoryBase::f_uninitialize, gsi::arg ("dispatcher"),
|
||||
"@brief Gets called when the application shuts down and the plugin is unregistered\n"
|
||||
"This event can be used to free resources allocated with this factory singleton.\n"
|
||||
"@args root\n"
|
||||
"@param root The reference to the \\MainWindow object\n"
|
||||
"@param dispatcher The reference to the \\MainWindow object\n"
|
||||
) +
|
||||
factory_callback ("create_plugin", &gsi::PluginFactoryBase::create_plugin_gsi, &gsi::PluginFactoryBase::f_create_plugin,
|
||||
factory_callback ("create_plugin", &gsi::PluginFactoryBase::create_plugin_gsi, &gsi::PluginFactoryBase::f_create_plugin, gsi::arg ("manager"), gsi::arg ("dispatcher"), gsi::arg ("view"),
|
||||
"@brief Creates the plugin\n"
|
||||
"This is the basic functionality that the factory must provide. This method must create a plugin of the "
|
||||
"specific type.\n"
|
||||
"@args manager, root, view\n"
|
||||
"@param manager The database manager object responsible for handling database transactions\n"
|
||||
"@param root The reference to the \\MainWindow object\n"
|
||||
"@param dispatcher The reference to the \\MainWindow object\n"
|
||||
"@param view The \\LayoutView that is plugin is created for\n"
|
||||
"@return The new \\Plugin implementation object\n"
|
||||
) +
|
||||
method ("add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry1,
|
||||
method ("add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry1, gsi::arg ("menu_name"), gsi::arg ("insert_pos"),
|
||||
"@brief Specifies a separator\n"
|
||||
"@args menu_name, insert_pos\n"
|
||||
"Call this method in the factory constructor to build the menu items that this plugin shall create.\n"
|
||||
"This specific call inserts a separator at the given position (insert_pos). The position uses abstract menu item paths "
|
||||
"and \"menu_name\" names the component that will be created. See \\AbstractMenu for a description of the path.\n"
|
||||
) +
|
||||
method ("add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry2,
|
||||
method ("add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry2, gsi::arg ("symbol"), gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"),
|
||||
"@brief Specifies a menu item\n"
|
||||
"@args symbol, menu_name, insert_pos, title\n"
|
||||
"Call this method in the factory constructor to build the menu items that this plugin shall create.\n"
|
||||
"This specific call inserts a menu item at the specified position (insert_pos). The position uses abstract menu item paths "
|
||||
"and \"menu_name\" names the component that will be created. See \\AbstractMenu for a description of the path.\n"
|
||||
|
|
@ -537,15 +541,28 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
"@param insert_pos The position where to create the entry\n"
|
||||
"@param title The title string for the item. The title can contain a keyboard shortcut in round braces after the title text, i.e. \"My Menu Item(F12)\"\n"
|
||||
) +
|
||||
method ("add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry3,
|
||||
method ("#add_menu_entry", &gsi::PluginFactoryBase::add_menu_entry3, gsi::arg ("symbol"), gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"), gsi::arg ("sub_menu"),
|
||||
"@brief Specifies a menu item or sub-menu\n"
|
||||
"@args symbol, menu_name, insert_pos, title, sub_menu\n"
|
||||
"Similar to the previous form of \"add_menu_entry\", but this version allows also to create sub-menus by setting the "
|
||||
"last parameter to \"true\""
|
||||
"last parameter to \"true\".\n"
|
||||
"\n"
|
||||
"With version 0.27 it's more convenient to use \\add_submenu."
|
||||
) +
|
||||
method ("add_option", &gsi::PluginFactoryBase::add_option,
|
||||
method ("add_submenu", &gsi::PluginFactoryBase::add_submenu, gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"),
|
||||
"@brief Specifies a menu item or sub-menu\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.27."
|
||||
) +
|
||||
method ("add_config_menu_item", &gsi::PluginFactoryBase::add_config_menu_item, gsi::arg ("menu_name"), gsi::arg ("insert_pos"), gsi::arg ("title"), gsi::arg ("cname"), gsi::arg ("cvalue"),
|
||||
"@brief Adds a configuration menu item\n"
|
||||
"\n"
|
||||
"Menu items created this way will send a configuration request with 'cname' as the configuration parameter name "
|
||||
"and 'cvalue' as the configuration parameter value.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.27."
|
||||
) +
|
||||
method ("add_option", &gsi::PluginFactoryBase::add_option, gsi::arg ("name"), gsi::arg ("default_value"),
|
||||
"@brief Specifies configuration variables.\n"
|
||||
"@args name, default_value\n"
|
||||
"Call this method in the factory constructor to add configuration key/value pairs to the configuration repository. "
|
||||
"Without specifying configuration variables, the status of a plugin cannot be persisted. "
|
||||
"\n\n"
|
||||
|
|
@ -555,9 +572,8 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
"doing so has the advantage that it is guaranteed that a variable with this keys exists and has the given default value initially."
|
||||
"\n\n"
|
||||
) +
|
||||
method ("has_tool_entry=", &gsi::PluginFactoryBase::has_tool_entry,
|
||||
method ("has_tool_entry=", &gsi::PluginFactoryBase::has_tool_entry, gsi::arg ("f"),
|
||||
"@brief Enables or disables the tool bar entry\n"
|
||||
"@args f\n"
|
||||
"Initially this property is set to true. This means that the plugin will have a visible entry in the toolbar. "
|
||||
"This property can be set to false to disable this feature. In that case, the title and icon given on registration will be ignored. "
|
||||
),
|
||||
|
|
@ -601,7 +617,7 @@ Class<gsi::PluginFactoryBase> decl_PluginFactory ("lay", "PluginFactory",
|
|||
" end\n"
|
||||
" \n"
|
||||
" # Create a new plugin instance of the custom type\n"
|
||||
" def create_plugin(manager, root, view)\n"
|
||||
" def create_plugin(manager, dispatcher, view)\n"
|
||||
" return PluginTest.new\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
|
|
@ -849,22 +865,22 @@ Class<gsi::ButtonStateNamespace> decl_ButtonState ("lay", "ButtonState",
|
|||
);
|
||||
|
||||
static std::vector<std::string>
|
||||
get_config_names (lay::PluginRoot *root)
|
||||
get_config_names (lay::Dispatcher *dispatcher)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
root->get_config_names (names);
|
||||
dispatcher->get_config_names (names);
|
||||
return names;
|
||||
}
|
||||
|
||||
static lay::PluginRoot *config_root_instance ()
|
||||
static lay::Dispatcher *dispatcher_instance ()
|
||||
{
|
||||
return lay::PluginRoot::instance ();
|
||||
return lay::Dispatcher::instance ();
|
||||
}
|
||||
|
||||
static tl::Variant get_config (lay::PluginRoot *root, const std::string &name)
|
||||
static tl::Variant get_config (lay::Dispatcher *dispatcher, const std::string &name)
|
||||
{
|
||||
std::string value;
|
||||
if (root->config_get (name, value)) {
|
||||
if (dispatcher->config_get (name, value)) {
|
||||
return tl::Variant (value);
|
||||
} else {
|
||||
return tl::Variant ();
|
||||
|
|
@ -872,54 +888,50 @@ static tl::Variant get_config (lay::PluginRoot *root, const std::string &name)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Exposes the PluginRoot interface
|
||||
* @brief Exposes the Dispatcher interface
|
||||
*
|
||||
* This interface is intentionally not derived from Plugin. It is used currently to
|
||||
* identify the plugin root node for configuration. The Plugin nature of this interface
|
||||
* identify the dispatcher node for configuration. The Plugin nature of this interface
|
||||
* is somewhat artificial and may be removed later.
|
||||
*
|
||||
* TODO: this is a duplicate of the respective methods in LayoutView and Application.
|
||||
* This is intentional since we don't want to spend the only derivation path on this.
|
||||
* Once there is a mixin concept, provide a path through that concept.
|
||||
*/
|
||||
Class<lay::PluginRoot> decl_PluginRoot ("lay", "PluginRoot",
|
||||
method ("clear_config", &lay::PluginRoot::clear_config,
|
||||
Class<lay::Dispatcher> decl_Dispatcher ("lay", "Dispatcher",
|
||||
method ("clear_config", &lay::Dispatcher::clear_config,
|
||||
"@brief Clears the configuration parameters\n"
|
||||
) +
|
||||
method ("instance", &config_root_instance,
|
||||
method ("instance", &dispatcher_instance,
|
||||
"@brief Gets the singleton instance of the PluginRoot object\n"
|
||||
"\n"
|
||||
"@return The instance\n"
|
||||
) +
|
||||
method ("write_config", &lay::PluginRoot::write_config,
|
||||
method ("write_config", &lay::Dispatcher::write_config, gsi::arg ("file_name"),
|
||||
"@brief Writes configuration to a file\n"
|
||||
"@args file_name\n"
|
||||
"@return A value indicating whether the operation was successful\n"
|
||||
"\n"
|
||||
"If the configuration file cannot be written, false \n"
|
||||
"is returned but no exception is thrown.\n"
|
||||
) +
|
||||
method ("read_config", &lay::PluginRoot::read_config,
|
||||
method ("read_config", &lay::Dispatcher::read_config, gsi::arg ("file_name"),
|
||||
"@brief Reads the configuration from a file\n"
|
||||
"@args file_name\n"
|
||||
"@return A value indicating whether the operation was successful\n"
|
||||
"\n"
|
||||
"This method siletly does nothing, if the config file does not\n"
|
||||
"exist. If it does and an error occurred, the error message is printed\n"
|
||||
"on stderr. In both cases, false is returned.\n"
|
||||
) +
|
||||
method_ext ("get_config", &get_config,
|
||||
method_ext ("get_config", &get_config, gsi::arg ("name"),
|
||||
"@brief Gets the value of a local configuration parameter\n"
|
||||
"\n"
|
||||
"@args name\n"
|
||||
"@param name The name of the configuration parameter whose value shall be obtained (a string)\n"
|
||||
"\n"
|
||||
"@return The value of the parameter or nil if there is no such parameter\n"
|
||||
) +
|
||||
method ("set_config", (void (lay::PluginRoot::*) (const std::string &, const std::string &)) &lay::PluginRoot::config_set,
|
||||
method ("set_config", (void (lay::Dispatcher::*) (const std::string &, const std::string &)) &lay::Dispatcher::config_set, gsi::arg ("name"), gsi::arg ("value"),
|
||||
"@brief Set a local configuration parameter with the given name to the given value\n"
|
||||
"\n"
|
||||
"@args name, value\n"
|
||||
"@param name The name of the configuration parameter to set\n"
|
||||
"@param value The value to which to set the configuration parameter\n"
|
||||
"\n"
|
||||
|
|
@ -937,14 +949,14 @@ Class<lay::PluginRoot> decl_PluginRoot ("lay", "PluginRoot",
|
|||
"This method returns the names of all known configuration parameters. These names can be used to "
|
||||
"get and set configuration parameter values.\n"
|
||||
) +
|
||||
method ("commit_config", &lay::PluginRoot::config_end,
|
||||
method ("commit_config", &lay::Dispatcher::config_end,
|
||||
"@brief Commits the configuration settings\n"
|
||||
"\n"
|
||||
"Some configuration options are queued for performance reasons and become active only after 'commit_config' has been called. "
|
||||
"After a sequence of \\set_config calls, this method should be called to activate the "
|
||||
"settings made by these calls.\n"
|
||||
),
|
||||
"@brief Root of the configuration space in the plugin context\n"
|
||||
"@brief Root of the configuration space in the plugin context and menu dispatcher\n"
|
||||
"\n"
|
||||
"This class provides access to the root configuration space in the context "
|
||||
"of plugin programming. You can use this class to obtain configuration parameters "
|
||||
|
|
@ -952,12 +964,12 @@ Class<lay::PluginRoot> decl_PluginRoot ("lay", "PluginRoot",
|
|||
"preferred way of plugin configuration is through \\Plugin#configure.\n"
|
||||
"\n"
|
||||
"Currently, the application object provides an identical entry point for configuration modification. "
|
||||
"For example, \"Application::instance.set_config\" is identical to \"PluginRoot::instance.set_config\". "
|
||||
"Hence there is little motivation for the PluginRoot class currently and "
|
||||
"For example, \"Application::instance.set_config\" is identical to \"Dispatcher::instance.set_config\". "
|
||||
"Hence there is little motivation for the Dispatcher class currently and "
|
||||
"this interface may be modified or removed in the future."
|
||||
"\n"
|
||||
"\n"
|
||||
"This class has been introduced in version 0.25.\n"
|
||||
"This class has been introduced in version 0.25 as 'PluginRoot'.\n"
|
||||
"It is renamed and enhanced as 'Dispatcher' in 0.27."
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
|
||||
#include "layAbstractMenu.h"
|
||||
#include "layAbstractMenuProvider.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "layPlugin.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlAssert.h"
|
||||
#include "gtf.h"
|
||||
#include "gsi.h"
|
||||
|
|
@ -574,8 +574,8 @@ ActionHandle::get_key_sequence_for (const std::string &sc) const
|
|||
Action::Action ()
|
||||
: mp_handle (0)
|
||||
{
|
||||
if (lay::AbstractMenuProvider::instance ()) {
|
||||
mp_handle = new ActionHandle (lay::AbstractMenuProvider::instance ()->menu_parent_widget ());
|
||||
if (lay::Dispatcher::instance ()) {
|
||||
mp_handle = new ActionHandle (lay::Dispatcher::instance ()->menu_parent_widget ());
|
||||
gtf::action_connect (mp_handle->ptr (), SIGNAL (triggered ()), this, SLOT (triggered_slot ()));
|
||||
mp_handle->add_ref ();
|
||||
}
|
||||
|
|
@ -920,14 +920,14 @@ Action::set_object_name (const std::string &name)
|
|||
// ---------------------------------------------------------------
|
||||
// ConfigureAction implementation
|
||||
|
||||
ConfigureAction::ConfigureAction (lay::PluginRoot *pr)
|
||||
: Action (), m_pr (pr), m_type (ConfigureAction::setter_type)
|
||||
ConfigureAction::ConfigureAction (lay::Dispatcher *dispatcher)
|
||||
: Action (), m_dispatcher (dispatcher), m_type (ConfigureAction::setter_type)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
ConfigureAction::ConfigureAction (lay::PluginRoot *pr, const std::string &cname, const std::string &cvalue)
|
||||
: Action (), m_pr (pr), m_cname (cname), m_cvalue (cvalue), m_type (ConfigureAction::setter_type)
|
||||
ConfigureAction::ConfigureAction (lay::Dispatcher *dispatcher, const std::string &cname, const std::string &cvalue)
|
||||
: Action (), m_dispatcher (dispatcher), m_cname (cname), m_cvalue (cvalue), m_type (ConfigureAction::setter_type)
|
||||
{
|
||||
if (cvalue == "?") {
|
||||
m_type = boolean_type;
|
||||
|
|
@ -937,8 +937,8 @@ ConfigureAction::ConfigureAction (lay::PluginRoot *pr, const std::string &cname,
|
|||
reg ();
|
||||
}
|
||||
|
||||
ConfigureAction::ConfigureAction (lay::PluginRoot *pr, const std::string &title, const std::string &cname, const std::string &cvalue)
|
||||
: Action (title), m_pr (pr), m_cname (cname), m_cvalue (cvalue), m_type (ConfigureAction::setter_type)
|
||||
ConfigureAction::ConfigureAction (lay::Dispatcher *dispatcher, const std::string &title, const std::string &cname, const std::string &cvalue)
|
||||
: Action (title), m_dispatcher (dispatcher), m_cname (cname), m_cvalue (cvalue), m_type (ConfigureAction::setter_type)
|
||||
{
|
||||
if (cvalue == "?") {
|
||||
// A "?" notation indicates a boolean toogle entry
|
||||
|
|
@ -966,23 +966,19 @@ ConfigureAction::triggered ()
|
|||
m_cvalue = tl::to_string (is_checked ());
|
||||
}
|
||||
|
||||
m_pr->config_set (m_cname, m_cvalue);
|
||||
m_dispatcher->config_set (m_cname, m_cvalue);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigureAction::reg ()
|
||||
{
|
||||
if (lay::AbstractMenuProvider::instance ()) {
|
||||
lay::AbstractMenuProvider::instance ()->register_config_action (m_cname, this);
|
||||
}
|
||||
m_dispatcher->register_config_action (m_cname, this);
|
||||
}
|
||||
|
||||
void
|
||||
ConfigureAction::unreg ()
|
||||
{
|
||||
if (lay::AbstractMenuProvider::instance ()) {
|
||||
lay::AbstractMenuProvider::instance ()->unregister_config_action (m_cname, this);
|
||||
}
|
||||
m_dispatcher->unregister_config_action (m_cname, this);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1008,13 +1004,8 @@ ConfigureAction::configure (const std::string &value)
|
|||
// AbstractMenu implementation
|
||||
|
||||
ActionHandle *
|
||||
AbstractMenu::create_action (const std::string &s, AbstractMenuProvider *provider)
|
||||
AbstractMenu::create_action (const std::string &s, lay::Dispatcher *dispatcher)
|
||||
{
|
||||
if (! provider) {
|
||||
provider = lay::AbstractMenuProvider::instance ();
|
||||
}
|
||||
tl_assert (provider != 0);
|
||||
|
||||
std::string title;
|
||||
std::string shortcut;
|
||||
std::string res;
|
||||
|
|
@ -1022,7 +1013,7 @@ AbstractMenu::create_action (const std::string &s, AbstractMenuProvider *provide
|
|||
|
||||
parse_menu_title (s, title, shortcut, res, tool_tip);
|
||||
|
||||
ActionHandle *ah = new ActionHandle (provider->menu_parent_widget ());
|
||||
ActionHandle *ah = new ActionHandle (dispatcher->menu_parent_widget ());
|
||||
ah->ptr ()->setText (tl::to_qstring (title));
|
||||
|
||||
if (! tool_tip.empty ()) {
|
||||
|
|
@ -1040,8 +1031,8 @@ AbstractMenu::create_action (const std::string &s, AbstractMenuProvider *provide
|
|||
return ah;
|
||||
}
|
||||
|
||||
AbstractMenu::AbstractMenu (AbstractMenuProvider *provider)
|
||||
: mp_provider (provider)
|
||||
AbstractMenu::AbstractMenu (Dispatcher *dispatcher)
|
||||
: mp_dispatcher (dispatcher)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -1051,13 +1042,6 @@ AbstractMenu::~AbstractMenu ()
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void
|
||||
AbstractMenu::init (const MenuLayoutEntry *layout)
|
||||
{
|
||||
m_root.set_has_submenu ();
|
||||
transfer (layout, m_root);
|
||||
}
|
||||
|
||||
QActionGroup *
|
||||
AbstractMenu::make_exclusive_group (const std::string &name)
|
||||
{
|
||||
|
|
@ -1167,8 +1151,8 @@ AbstractMenu::build (QMenuBar *mbar, QToolBar *tbar)
|
|||
// Otherwise, the keyboard shortcuts do not work for menu items inside such a
|
||||
// popup menu. It seems not to have a negative effect to add the menu to the
|
||||
// main widget.
|
||||
if (mp_provider) {
|
||||
mp_provider->menu_parent_widget ()->addAction (menu->menuAction ());
|
||||
if (mp_dispatcher->menu_parent_widget ()) {
|
||||
mp_dispatcher->menu_parent_widget ()->addAction (menu->menuAction ());
|
||||
}
|
||||
c->set_action (Action (new ActionHandle (menu)), true);
|
||||
}
|
||||
|
|
@ -1379,27 +1363,32 @@ AbstractMenu::items (const std::string &path) const
|
|||
void
|
||||
AbstractMenu::insert_item (const std::string &p, const std::string &name, const Action &action)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (p);
|
||||
if (! path.empty ()) {
|
||||
tl::Extractor extr (p.c_str ());
|
||||
while (! extr.at_end ()) {
|
||||
|
||||
AbstractMenuItem *parent = path.back ().first;
|
||||
std::list<AbstractMenuItem>::iterator iter = path.back ().second;
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (extr);
|
||||
if (! path.empty ()) {
|
||||
|
||||
// insert the new item
|
||||
parent->children.insert (iter, AbstractMenuItem ());
|
||||
--iter;
|
||||
AbstractMenuItem *parent = path.back ().first;
|
||||
std::list<AbstractMenuItem>::iterator iter = path.back ().second;
|
||||
|
||||
iter->setup_item (parent->name (), name, action);
|
||||
// insert the new item
|
||||
parent->children.insert (iter, AbstractMenuItem ());
|
||||
--iter;
|
||||
|
||||
// find any items with the same name and remove them
|
||||
for (std::list<AbstractMenuItem>::iterator existing = parent->children.begin (); existing != parent->children.end (); ) {
|
||||
std::list<AbstractMenuItem>::iterator existing_next = existing;
|
||||
++existing_next;
|
||||
if (existing->name () == iter->name () && existing != iter) {
|
||||
parent->children.erase (existing);
|
||||
iter->setup_item (parent->name (), name, action);
|
||||
|
||||
// find any items with the same name and remove them
|
||||
for (std::list<AbstractMenuItem>::iterator existing = parent->children.begin (); existing != parent->children.end (); ) {
|
||||
std::list<AbstractMenuItem>::iterator existing_next = existing;
|
||||
++existing_next;
|
||||
if (existing->name () == iter->name () && existing != iter) {
|
||||
parent->children.erase (existing);
|
||||
}
|
||||
existing = existing_next;
|
||||
}
|
||||
existing = existing_next;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1411,7 +1400,8 @@ void
|
|||
AbstractMenu::insert_separator (const std::string &p, const std::string &name)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (p);
|
||||
tl::Extractor extr (p.c_str ());
|
||||
path_type path = find_item (extr);
|
||||
if (! path.empty ()) {
|
||||
|
||||
AbstractMenuItem *parent = path.back ().first;
|
||||
|
|
@ -1419,7 +1409,7 @@ AbstractMenu::insert_separator (const std::string &p, const std::string &name)
|
|||
|
||||
parent->children.insert (iter, AbstractMenuItem ());
|
||||
--iter;
|
||||
Action action (new ActionHandle (mp_provider ? mp_provider->menu_parent_widget () : 0));
|
||||
Action action (new ActionHandle (mp_dispatcher->menu_parent_widget ()));
|
||||
action.set_separator (true);
|
||||
iter->setup_item (parent->name (), name, action);
|
||||
|
||||
|
|
@ -1432,7 +1422,8 @@ void
|
|||
AbstractMenu::insert_menu (const std::string &p, const std::string &name, const Action &action)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (p);
|
||||
tl::Extractor extr (p.c_str ());
|
||||
path_type path = find_item (extr);
|
||||
if (! path.empty ()) {
|
||||
|
||||
AbstractMenuItem *parent = path.back ().first;
|
||||
|
|
@ -1461,14 +1452,15 @@ AbstractMenu::insert_menu (const std::string &p, const std::string &name, const
|
|||
void
|
||||
AbstractMenu::insert_menu (const std::string &path, const std::string &name, const std::string &title)
|
||||
{
|
||||
insert_menu (path, name, create_action (title, mp_provider));
|
||||
insert_menu (path, name, create_action (title, mp_dispatcher));
|
||||
}
|
||||
|
||||
void
|
||||
AbstractMenu::clear_menu (const std::string &p)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (p);
|
||||
tl::Extractor extr (p.c_str ());
|
||||
path_type path = find_item (extr);
|
||||
if (! path.empty () && ! path.back ().second->children.empty ()) {
|
||||
path.back ().second->children.clear ();
|
||||
emit changed ();
|
||||
|
|
@ -1479,7 +1471,8 @@ void
|
|||
AbstractMenu::delete_item (const std::string &p)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator > > path_type;
|
||||
path_type path = find_item (p);
|
||||
tl::Extractor extr (p.c_str ());
|
||||
path_type path = find_item (extr);
|
||||
if (! path.empty ()) {
|
||||
|
||||
for (path_type::const_reverse_iterator p = path.rbegin (); p != path.rend (); ++p) {
|
||||
|
|
@ -1588,18 +1581,21 @@ AbstractMenu::find_item_exact (const std::string &path)
|
|||
}
|
||||
|
||||
std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> >
|
||||
AbstractMenu::find_item (const std::string &p)
|
||||
AbstractMenu::find_item (tl::Extractor &extr)
|
||||
{
|
||||
typedef std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> > path_type;
|
||||
path_type path;
|
||||
|
||||
tl::Extractor extr (p.c_str ());
|
||||
AbstractMenuItem *parent = &m_root;
|
||||
std::list<AbstractMenuItem>::iterator iter = m_root.children.end ();
|
||||
|
||||
while (parent && ! extr.at_end ()) {
|
||||
|
||||
if (extr.test ("#")) {
|
||||
if (extr.test (";")) {
|
||||
|
||||
break;
|
||||
|
||||
} else if (extr.test ("#")) {
|
||||
|
||||
unsigned int n = 0;
|
||||
extr.try_read (n);
|
||||
|
|
@ -1721,71 +1717,6 @@ AbstractMenu::find_item (const std::string &p)
|
|||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
AbstractMenu::transfer (const MenuLayoutEntry *layout, AbstractMenuItem &item)
|
||||
{
|
||||
while (layout->name) {
|
||||
|
||||
item.children.push_back (AbstractMenuItem ());
|
||||
AbstractMenuItem &new_item = item.children.back ();
|
||||
|
||||
lay::Action a;
|
||||
|
||||
if (! mp_provider) {
|
||||
a = lay::Action (new ActionHandle ((QWidget *) 0));
|
||||
} else if (layout->slot) {
|
||||
// reuse any actions already registered for this slot
|
||||
a = mp_provider->action_for_slot (layout->slot);
|
||||
} else if (! layout->kv_pair.first.empty ()) {
|
||||
a = *mp_provider->create_config_action (layout->kv_pair.first, layout->kv_pair.second);
|
||||
} else {
|
||||
a = lay::Action (new ActionHandle (mp_provider->menu_parent_widget ()));
|
||||
}
|
||||
|
||||
if (layout->title == "-") {
|
||||
|
||||
// reuse title from other entry
|
||||
|
||||
} else if (! layout->title.empty ()) {
|
||||
|
||||
std::string title;
|
||||
std::string shortcut;
|
||||
std::string res;
|
||||
std::string tool_tip;
|
||||
|
||||
parse_menu_title (layout->title, title, shortcut, res, tool_tip);
|
||||
|
||||
a.set_separator (false);
|
||||
a.set_title (title);
|
||||
|
||||
if (! shortcut.empty ()) {
|
||||
a.set_default_shortcut (shortcut);
|
||||
}
|
||||
|
||||
if (! tool_tip.empty ()) {
|
||||
a.set_tool_tip (tool_tip);
|
||||
}
|
||||
|
||||
if (! res.empty ()) {
|
||||
a.set_icon (res);
|
||||
}
|
||||
|
||||
} else {
|
||||
a.set_separator (true);
|
||||
}
|
||||
|
||||
new_item.setup_item (item.name (), layout->name, a);
|
||||
|
||||
if (layout->submenu) {
|
||||
new_item.set_has_submenu ();
|
||||
transfer (layout->submenu, item.children.back ());
|
||||
}
|
||||
|
||||
++layout;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
AbstractMenu::group (const std::string &name) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,10 +50,9 @@ class QMenu;
|
|||
namespace lay
|
||||
{
|
||||
|
||||
class AbstractMenuProvider;
|
||||
class Action;
|
||||
class AbstractMenu;
|
||||
class PluginRoot;
|
||||
class Dispatcher;
|
||||
|
||||
/**
|
||||
* @brief A utility function to convert the packed key binding in the cfg_key_bindings string to a vector
|
||||
|
|
@ -406,7 +405,7 @@ private:
|
|||
/**
|
||||
* @brief A specialisation for the Action to issue a "configure" request on "triggered"
|
||||
*
|
||||
* When this action is triggered, a "configure" request is issued to the PluginRoot instance
|
||||
* When this action is triggered, a "configure" request is issued to the Dispatcher instance
|
||||
* (which is the root of the configuration hierarchy). The name and value is given by the
|
||||
* respective parameters passed to the constructor or set with the write accessors.
|
||||
*/
|
||||
|
|
@ -420,21 +419,21 @@ public:
|
|||
/**
|
||||
* @brief The default constructor
|
||||
*
|
||||
* @param pr The reference to the plugin root object which receives the configure request
|
||||
* @param dispatcher The reference to the dispatcher object which receives the configure request
|
||||
*/
|
||||
ConfigureAction (lay::PluginRoot *pr);
|
||||
ConfigureAction (lay::Dispatcher *dispatcher);
|
||||
|
||||
/**
|
||||
* @brief Create an configure action with the given name and value
|
||||
*
|
||||
* @param pr The reference to the plugin root object which receives the configure request
|
||||
* @param dispatcher The reference to the dispatcher object which receives the configure request
|
||||
* @param cname The name of the configuration parameter to set
|
||||
* @param cvalue The value to set "cname" to
|
||||
*
|
||||
* The value can be "?" in which case the configuration action describes
|
||||
* a boolean parameter which is mapped to a checkable action.
|
||||
*/
|
||||
ConfigureAction (lay::PluginRoot *pr, const std::string &cname, const std::string &value);
|
||||
ConfigureAction (lay::Dispatcher *dispatcher, const std::string &cname, const std::string &value);
|
||||
|
||||
/**
|
||||
* @brief Create an configure action with the given title (icon, keyboard shortcut), name and value
|
||||
|
|
@ -449,7 +448,7 @@ public:
|
|||
* The value can be "?" in which case the configuration action describes
|
||||
* a boolean parameter which is mapped to a checkable action.
|
||||
*/
|
||||
ConfigureAction (lay::PluginRoot *pr, const std::string &title, const std::string &cname, const std::string &value);
|
||||
ConfigureAction (lay::Dispatcher *dispatcher, const std::string &title, const std::string &cname, const std::string &value);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
|
|
@ -505,63 +504,11 @@ private:
|
|||
ConfigureAction (const ConfigureAction &action);
|
||||
ConfigureAction &operator= (const ConfigureAction &action);
|
||||
|
||||
lay::PluginRoot *m_pr;
|
||||
lay::Dispatcher *m_dispatcher;
|
||||
std::string m_cname, m_cvalue;
|
||||
type m_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A menu layout entry for static initialisation
|
||||
*
|
||||
* These objects act as the "source" for creating the initial AbstractLayout setup.
|
||||
*/
|
||||
struct LAYBASIC_PUBLIC MenuLayoutEntry {
|
||||
|
||||
MenuLayoutEntry (const char *_name,
|
||||
const std::string &_title,
|
||||
const std::pair<std::string, std::string> &_kv_pair)
|
||||
: name (_name), title (_title), slot (0), kv_pair (_kv_pair), submenu (0)
|
||||
{ }
|
||||
|
||||
MenuLayoutEntry (const char *_name,
|
||||
const std::string &_title,
|
||||
const char *_slot,
|
||||
const MenuLayoutEntry *_submenu = 0)
|
||||
: name (_name), title (_title), slot (_slot), submenu (_submenu)
|
||||
{ }
|
||||
|
||||
MenuLayoutEntry (const char *_name,
|
||||
const std::string &_title,
|
||||
const MenuLayoutEntry *_submenu = 0)
|
||||
: name (_name), title (_title), slot (0), submenu (_submenu)
|
||||
{ }
|
||||
|
||||
MenuLayoutEntry (const char *_name)
|
||||
: name (_name), slot (0), submenu (0)
|
||||
{ }
|
||||
|
||||
MenuLayoutEntry ()
|
||||
: name (0), slot (0), submenu (0)
|
||||
{ }
|
||||
|
||||
static MenuLayoutEntry separator (const char *name)
|
||||
{
|
||||
return MenuLayoutEntry (name);
|
||||
}
|
||||
|
||||
static MenuLayoutEntry last ()
|
||||
{
|
||||
return MenuLayoutEntry ();
|
||||
}
|
||||
|
||||
const char *name;
|
||||
std::string title;
|
||||
const char *slot;
|
||||
std::pair<std::string, std::string> kv_pair;
|
||||
const MenuLayoutEntry *submenu;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief One item in the abstract menu
|
||||
*/
|
||||
|
|
@ -636,11 +583,6 @@ private:
|
|||
* Each item can be associated with a Action, which delivers a title, enabled/disable state etc.
|
||||
* The Action is either provided when new entries are inserted or created upon initialisation.
|
||||
*
|
||||
* An abstract menu is initialised from a initialisation sequence given by a list of
|
||||
* MenuLayoutEntry objects terminated with a MenuLayoutEntry::last() item.
|
||||
* Each of these entries may provide a submenu. Beside for initialisation, these entries
|
||||
* are not used further.
|
||||
*
|
||||
* The abstract menu class provides methods to manipulate the menu structure (the state of the
|
||||
* menu items, their title and shortcut key is provided and manipulated through the Action object).
|
||||
*
|
||||
|
|
@ -684,18 +626,13 @@ public:
|
|||
/**
|
||||
* @brief Create the abstract menu object attached to the given main window
|
||||
*/
|
||||
AbstractMenu (AbstractMenuProvider *provider);
|
||||
AbstractMenu (Dispatcher *dispatcher);
|
||||
|
||||
/**
|
||||
* @brief Destroy the abstract menu object
|
||||
*/
|
||||
~AbstractMenu ();
|
||||
|
||||
/**
|
||||
* @brief Initialise from a sequence of MenuLayoutEntry objects
|
||||
*/
|
||||
void init (const MenuLayoutEntry *layout);
|
||||
|
||||
/**
|
||||
* @brief Rebuild the QMenu's and refill the QMenuBar object
|
||||
*/
|
||||
|
|
@ -873,10 +810,9 @@ signals:
|
|||
private:
|
||||
friend class Action;
|
||||
|
||||
std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> > find_item (const std::string &path);
|
||||
std::vector<std::pair<AbstractMenuItem *, std::list<AbstractMenuItem>::iterator> > find_item (tl::Extractor &extr);
|
||||
const AbstractMenuItem *find_item_exact (const std::string &path) const;
|
||||
AbstractMenuItem *find_item_exact (const std::string &path);
|
||||
void transfer (const MenuLayoutEntry *layout, AbstractMenuItem &item);
|
||||
void build (QMenu *menu, std::list<AbstractMenuItem> &items);
|
||||
void build (QToolBar *tbar, std::list<AbstractMenuItem> &items);
|
||||
void collect_group (std::vector<std::string> &grp, const std::string &name, const AbstractMenuItem &item) const;
|
||||
|
|
@ -890,9 +826,9 @@ private:
|
|||
* @param provider The abstract menu provider (the global one will be used if this instance is 0)
|
||||
* @return The ActionHandle object created
|
||||
*/
|
||||
static ActionHandle *create_action (const std::string &s, lay::AbstractMenuProvider *provider);
|
||||
static ActionHandle *create_action (const std::string &s, lay::Dispatcher *dispatcher);
|
||||
|
||||
AbstractMenuProvider *mp_provider;
|
||||
Dispatcher *mp_dispatcher;
|
||||
AbstractMenuItem m_root;
|
||||
tl::stable_vector<QMenu> m_helper_menu_items;
|
||||
std::map<std::string, QActionGroup *> m_action_groups;
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "layAbstractMenuProvider.h"
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
static AbstractMenuProvider *ms_instance = 0;
|
||||
|
||||
AbstractMenuProvider::AbstractMenuProvider (bool reg_inst)
|
||||
{
|
||||
if (reg_inst && ! ms_instance) {
|
||||
ms_instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
AbstractMenuProvider::~AbstractMenuProvider ()
|
||||
{
|
||||
if (ms_instance == this) {
|
||||
ms_instance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
AbstractMenuProvider *AbstractMenuProvider::instance ()
|
||||
{
|
||||
return ms_instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_layAbstractMenuProvider
|
||||
#define HDR_layAbstractMenuProvider
|
||||
|
||||
#include "laybasicCommon.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
class AbstractMenu;
|
||||
class Action;
|
||||
class ConfigureAction;
|
||||
|
||||
/**
|
||||
* @brief An interface for the supplier of the abstract menu object
|
||||
*/
|
||||
class LAYBASIC_PUBLIC AbstractMenuProvider
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
* If "reg_inst" is true, this instance will become the global instance
|
||||
*/
|
||||
AbstractMenuProvider (bool reg_inst = true);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
virtual ~AbstractMenuProvider ();
|
||||
|
||||
/**
|
||||
* @brief Gets the AbstractMenu object
|
||||
*/
|
||||
virtual AbstractMenu *menu () = 0;
|
||||
|
||||
/**
|
||||
* @brief Gets the parent widget
|
||||
*/
|
||||
virtual QWidget *menu_parent_widget () = 0;
|
||||
|
||||
/**
|
||||
* @brief Get the action for a slot
|
||||
*/
|
||||
virtual lay::Action &action_for_slot (const char *slot) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create a configuration action with the given title, parameter name and value
|
||||
*
|
||||
* The action will be owned by the abstract menu provider but can be deleted to remove it from there.
|
||||
*/
|
||||
virtual lay::Action *create_config_action (const std::string &title, const std::string &cname, const std::string &cvalue) = 0;
|
||||
|
||||
/**
|
||||
* @brief Create a configuration action with the given parameter name and value
|
||||
*
|
||||
* The action will be owned by the abstract menu provider but can be deleted to remove it from there.
|
||||
* This version is provided for applications, where the title is set later.
|
||||
*/
|
||||
virtual lay::Action *create_config_action (const std::string &cname, const std::string &cvalue) = 0;
|
||||
|
||||
/**
|
||||
* @brief Register a configuration action with the given name
|
||||
*/
|
||||
virtual void register_config_action (const std::string &name, lay::ConfigureAction *action) = 0;
|
||||
|
||||
/**
|
||||
* @brief Unregister a configuration action with the given name
|
||||
*/
|
||||
virtual void unregister_config_action (const std::string &name, lay::ConfigureAction *action) = 0;
|
||||
|
||||
/**
|
||||
* @brief Gets the singleton instance of the AbstractMenuProvider object
|
||||
*/
|
||||
static AbstractMenuProvider *instance ();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -134,26 +134,6 @@ BookmarksView::follow_selection (bool f)
|
|||
m_follow_selection = f;
|
||||
}
|
||||
|
||||
void
|
||||
BookmarksView::init_menu (lay::AbstractMenu &menu)
|
||||
{
|
||||
MenuLayoutEntry context_menu [] = {
|
||||
MenuLayoutEntry ("follow_selection", tl::to_string (QObject::tr ("Follow Selection")), std::make_pair (cfg_bookmarks_follow_selection, "?")),
|
||||
MenuLayoutEntry::separator ("ops_group"),
|
||||
MenuLayoutEntry ("manage_bookmarks", tl::to_string (QObject::tr ("Manage Bookmarks")), SLOT (cm_manage_bookmarks ())),
|
||||
MenuLayoutEntry ("load_bookmarks", tl::to_string (QObject::tr ("Load Bookmarks")), SLOT (cm_load_bookmarks ())),
|
||||
MenuLayoutEntry ("save_bookmarks", tl::to_string (QObject::tr ("Save Bookmarks")), SLOT (cm_save_bookmarks ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry main_menu [] = {
|
||||
MenuLayoutEntry ("@bookmarks_context_menu", "", context_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (main_menu);
|
||||
}
|
||||
|
||||
void
|
||||
BookmarksView::set_background_color (QColor c)
|
||||
{
|
||||
|
|
@ -209,5 +189,30 @@ BookmarksView::bookmark_triggered (const QModelIndex &index)
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class BookmarksViewPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@bookmarks_context_menu", at, std::string ()));
|
||||
|
||||
at = "@bookmarks_context_menu.end";
|
||||
menu_entries.push_back (lay::config_menu_item ("follow_selection", at, tl::to_string (QObject::tr ("Follow Selection")), cfg_bookmarks_follow_selection, "?")),
|
||||
menu_entries.push_back (lay::separator ("ops_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_manage_bookmarks", "manage_bookmarks", at, tl::to_string (QObject::tr ("Manage Bookmarks")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_load_bookmarks", "load_bookmarks", at, tl::to_string (QObject::tr ("Load Bookmarks")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_save_bookmarks", "save_bookmarks", at, tl::to_string (QObject::tr ("Save Bookmarks")));
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new BookmarksViewPluginDeclaration (), -7, "BookmarksViewPlugin");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,6 @@ public:
|
|||
|
||||
void refresh ();
|
||||
|
||||
static void init_menu (lay::AbstractMenu &menu);
|
||||
|
||||
public slots:
|
||||
void bookmark_triggered (const QModelIndex &index);
|
||||
void current_bookmark_changed (const QModelIndex &index);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,282 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "layDispatcher.h"
|
||||
|
||||
#include "tlXMLParser.h"
|
||||
#include "tlXMLWriter.h"
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Dispatcher implementation
|
||||
|
||||
static Dispatcher *ms_dispatcher_instance = 0;
|
||||
|
||||
Dispatcher::Dispatcher (Plugin *parent, bool standalone)
|
||||
: Plugin (parent, standalone),
|
||||
m_menu (this)
|
||||
{
|
||||
if (! parent) {
|
||||
ms_dispatcher_instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
Dispatcher::~Dispatcher ()
|
||||
{
|
||||
if (ms_dispatcher_instance == this) {
|
||||
ms_dispatcher_instance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
lay::Action *
|
||||
Dispatcher::create_config_action (const std::string &title, const std::string &cname, const std::string &cvalue)
|
||||
{
|
||||
lay::ConfigureAction *ca = new lay::ConfigureAction (this, title, cname, cvalue);
|
||||
m_ca_collection.push_back (ca);
|
||||
return ca;
|
||||
}
|
||||
|
||||
lay::Action *
|
||||
Dispatcher::create_config_action (const std::string &cname, const std::string &cvalue)
|
||||
{
|
||||
lay::ConfigureAction *ca = new lay::ConfigureAction (this, std::string (), cname, cvalue);
|
||||
m_ca_collection.push_back (ca);
|
||||
return ca;
|
||||
}
|
||||
|
||||
void
|
||||
Dispatcher::register_config_action (const std::string &name, lay::ConfigureAction *action)
|
||||
{
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> >::iterator ca = m_configuration_actions.insert (std::make_pair (name, std::vector<lay::ConfigureAction *> ())).first;
|
||||
for (std::vector<lay::ConfigureAction *>::iterator a = ca->second.begin (); a != ca->second.end (); ++a) {
|
||||
if (*a == action) {
|
||||
return; // already registered
|
||||
}
|
||||
}
|
||||
|
||||
ca->second.push_back (action);
|
||||
}
|
||||
|
||||
void
|
||||
Dispatcher::unregister_config_action (const std::string &name, lay::ConfigureAction *action)
|
||||
{
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> >::iterator ca = m_configuration_actions.find (name);
|
||||
if (ca != m_configuration_actions.end ()) {
|
||||
for (std::vector<lay::ConfigureAction *>::iterator a = ca->second.begin (); a != ca->second.end (); ++a) {
|
||||
if (*a == action) {
|
||||
ca->second.erase (a);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Dispatcher::clear_configuration_actions ()
|
||||
{
|
||||
m_ca_collection.clear ();
|
||||
m_configuration_actions.clear ();
|
||||
}
|
||||
|
||||
bool
|
||||
Dispatcher::configure (const std::string &name, const std::string &value)
|
||||
{
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> >::iterator ca = m_configuration_actions.find (name);
|
||||
if (ca != m_configuration_actions.end ()) {
|
||||
for (std::vector<lay::ConfigureAction *>::const_iterator a = ca->second.begin (); a != ca->second.end (); ++a) {
|
||||
(*a)->configure (value);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writing and Reading of configuration
|
||||
|
||||
struct ConfigGetAdaptor
|
||||
{
|
||||
ConfigGetAdaptor (const std::string &name)
|
||||
: mp_owner (0), m_done (false), m_name (name)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
std::string operator () () const
|
||||
{
|
||||
std::string s;
|
||||
mp_owner->config_get (m_name, s);
|
||||
return s;
|
||||
}
|
||||
|
||||
bool at_end () const
|
||||
{
|
||||
return m_done;
|
||||
}
|
||||
|
||||
void start (const lay::Dispatcher &owner)
|
||||
{
|
||||
mp_owner = &owner;
|
||||
m_done = false;
|
||||
}
|
||||
|
||||
void next ()
|
||||
{
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
private:
|
||||
const lay::Dispatcher *mp_owner;
|
||||
bool m_done;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
struct ConfigGetNullAdaptor
|
||||
{
|
||||
ConfigGetNullAdaptor ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
std::string operator () () const
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
bool at_end () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void start (const lay::Dispatcher & /*owner*/) { }
|
||||
void next () { }
|
||||
};
|
||||
|
||||
struct ConfigNamedSetAdaptor
|
||||
{
|
||||
ConfigNamedSetAdaptor ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void operator () (lay::Dispatcher &w, tl::XMLReaderState &reader, const std::string &name) const
|
||||
{
|
||||
tl::XMLObjTag<std::string> tag;
|
||||
w.config_set (name, *reader.back (tag));
|
||||
}
|
||||
};
|
||||
|
||||
struct ConfigSetAdaptor
|
||||
{
|
||||
ConfigSetAdaptor (const std::string &name)
|
||||
: m_name (name)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void operator () (lay::Dispatcher &w, tl::XMLReaderState &reader) const
|
||||
{
|
||||
tl::XMLObjTag<std::string> tag;
|
||||
w.config_set (m_name, *reader.back (tag));
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
// the configuration file's XML structure is built dynamically
|
||||
static tl::XMLStruct<lay::Dispatcher>
|
||||
config_structure (const lay::Dispatcher *plugin)
|
||||
{
|
||||
tl::XMLElementList body;
|
||||
std::string n_with_underscores;
|
||||
|
||||
std::vector <std::string> names;
|
||||
plugin->get_config_names (names);
|
||||
|
||||
for (std::vector <std::string>::const_iterator n = names.begin (); n != names.end (); ++n) {
|
||||
|
||||
body.append (tl::XMLMember<std::string, lay::Dispatcher, ConfigGetAdaptor, ConfigSetAdaptor, tl::XMLStdConverter <std::string> > (
|
||||
ConfigGetAdaptor (*n), ConfigSetAdaptor (*n), *n));
|
||||
|
||||
// for compatibility, provide an alternative with underscores (i.e. 0.20->0.21 because of default_grids)
|
||||
n_with_underscores.clear ();
|
||||
for (const char *c = n->c_str (); *c; ++c) {
|
||||
n_with_underscores += (*c == '-' ? '_' : *c);
|
||||
}
|
||||
|
||||
body.append (tl::XMLMember<std::string, lay::Dispatcher, ConfigGetNullAdaptor, ConfigSetAdaptor, tl::XMLStdConverter <std::string> > (
|
||||
ConfigGetNullAdaptor (), ConfigSetAdaptor (*n), n_with_underscores));
|
||||
|
||||
}
|
||||
|
||||
// add a wildcard member to read all others unspecifically into the repository
|
||||
body.append (tl::XMLWildcardMember<std::string, lay::Dispatcher, ConfigNamedSetAdaptor, tl::XMLStdConverter <std::string> > (ConfigNamedSetAdaptor ()));
|
||||
|
||||
return tl::XMLStruct<lay::Dispatcher> ("config", body);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Dispatcher::write_config (const std::string &config_file)
|
||||
{
|
||||
try {
|
||||
tl::OutputStream os (config_file, tl::OutputStream::OM_Plain);
|
||||
config_structure (this).write (os, *this);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Dispatcher::read_config (const std::string &config_file)
|
||||
{
|
||||
std::auto_ptr<tl::XMLFileSource> file;
|
||||
|
||||
try {
|
||||
file.reset (new tl::XMLFileSource (config_file));
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
config_structure (this).parse (*file, *this);
|
||||
} catch (tl::Exception &ex) {
|
||||
std::string msg = tl::to_string (QObject::tr ("Problem reading config file ")) + config_file + ": " + ex.msg ();
|
||||
throw tl::Exception (msg);
|
||||
}
|
||||
|
||||
config_end ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Dispatcher *
|
||||
Dispatcher::instance ()
|
||||
{
|
||||
return ms_dispatcher_instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_layDispatcher
|
||||
#define HDR_layDispatcher
|
||||
|
||||
#include "laybasicCommon.h"
|
||||
|
||||
#include "tlTypeTraits.h"
|
||||
#include "tlObject.h"
|
||||
#include "layPlugin.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
class AbstractMenu;
|
||||
class Action;
|
||||
class ConfigureAction;
|
||||
|
||||
/**
|
||||
* @brief The central menu event and configuration dispatcher class
|
||||
*
|
||||
* This class acts as the top level dispatcher for plugin events and the menu configuration.
|
||||
*
|
||||
*/
|
||||
class LAYBASIC_PUBLIC Dispatcher
|
||||
: public Plugin
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*
|
||||
* @param parent Usually 0, but a dispatcher may have parents. In this case, the dispatcher is not the actual dispatcher, but the real plugin chain's root is.
|
||||
* @param standalone The standalone flag passed to the plugin constructor.
|
||||
*/
|
||||
Dispatcher (Plugin *parent, bool standalone = false);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~Dispatcher ();
|
||||
|
||||
/**
|
||||
* @brief Write configuration to a file
|
||||
*
|
||||
* If the configuration file cannot be written, false
|
||||
* is returned but no exception is thrown.
|
||||
*
|
||||
* @return false, if an error occurred.
|
||||
*/
|
||||
bool write_config (const std::string &config_file);
|
||||
|
||||
/**
|
||||
* @brief Read the configuration from a file
|
||||
*
|
||||
* This method siletly does nothing, if the config file does not
|
||||
* exist. If it does and an error occurred, the error message is printed
|
||||
* on stderr. In both cases, false is returned.
|
||||
*
|
||||
* @return false, if an error occurred.
|
||||
*/
|
||||
bool read_config (const std::string &config_file);
|
||||
|
||||
/**
|
||||
* @brief The singleton instance of the plugin root
|
||||
*/
|
||||
static Dispatcher *instance ();
|
||||
|
||||
/**
|
||||
* @brief Notifies the plugin root that a new plugin class has been registered
|
||||
*
|
||||
* This method is called when a plugin is loaded dynamically during runtime.
|
||||
*/
|
||||
virtual void plugin_registered (lay::PluginDeclaration * /*cls*/) { }
|
||||
|
||||
/**
|
||||
* @brief Notifies the plugin root that a plugin class is about to be removed
|
||||
*/
|
||||
virtual void plugin_removed (lay::PluginDeclaration * /*cls*/) { }
|
||||
|
||||
/**
|
||||
* @brief Selects the given mode
|
||||
*
|
||||
* The implementation is supposed to select the given mode on all related plugins.
|
||||
*/
|
||||
virtual void select_mode (int /*mode*/) { }
|
||||
|
||||
/**
|
||||
* @brief Gets the parent widget
|
||||
*/
|
||||
virtual QWidget *menu_parent_widget () { return 0; }
|
||||
|
||||
/**
|
||||
* @brief Gets the AbstractMenu object
|
||||
*/
|
||||
AbstractMenu *menu () { return &m_menu; }
|
||||
|
||||
/**
|
||||
* @brief Creates a configuration action with the given title, parameter name and value
|
||||
*
|
||||
* The action will be owned by the abstract menu provider but can be deleted to remove it from there.
|
||||
*/
|
||||
lay::Action *create_config_action (const std::string &title, const std::string &cname, const std::string &cvalue);
|
||||
|
||||
/**
|
||||
* @brief Creates a configuration action with the given parameter name and value
|
||||
*
|
||||
* The action will be owned by the abstract menu provider but can be deleted to remove it from there.
|
||||
* This version is provided for applications, where the title is set later.
|
||||
*/
|
||||
lay::Action *create_config_action (const std::string &cname, const std::string &cvalue);
|
||||
|
||||
/**
|
||||
* @brief Registers a configuration action with the given name
|
||||
*/
|
||||
void register_config_action (const std::string &name, lay::ConfigureAction *action);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a configuration action with the given name
|
||||
*/
|
||||
void unregister_config_action (const std::string &name, lay::ConfigureAction *action);
|
||||
|
||||
protected:
|
||||
// capture the configuration events so we can change the value of the configuration actions
|
||||
virtual bool configure (const std::string &name, const std::string &value);
|
||||
|
||||
void clear_configuration_actions ();
|
||||
|
||||
private:
|
||||
Dispatcher (const Dispatcher &);
|
||||
Dispatcher &operator= (const Dispatcher &);
|
||||
|
||||
lay::AbstractMenu m_menu;
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> > m_configuration_actions;
|
||||
tl::shared_collection<lay::ConfigureAction> m_ca_collection;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace tl
|
||||
{
|
||||
// disable copy ctor for Dispatcher
|
||||
template <> struct type_traits<lay::Dispatcher> : public type_traits<void> {
|
||||
typedef tl::false_tag has_copy_constructor;
|
||||
typedef tl::false_tag has_default_constructor;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ GridNetPluginDeclaration::config_page (QWidget *parent, std::string &title) cons
|
|||
}
|
||||
|
||||
lay::Plugin *
|
||||
GridNetPluginDeclaration::create_plugin (db::Manager *, lay::PluginRoot *, lay::LayoutView *view) const
|
||||
GridNetPluginDeclaration::create_plugin (db::Manager *, Dispatcher *, lay::LayoutView *view) const
|
||||
{
|
||||
return new lay::GridNet (view);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class GridNetPluginDeclaration
|
|||
public:
|
||||
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const;
|
||||
virtual lay::ConfigPage *config_page (QWidget *parent, std::string &title) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::PluginRoot *, lay::LayoutView *view) const;
|
||||
virtual lay::Plugin *create_plugin (db::Manager *, lay::Dispatcher *, lay::LayoutView *view) const;
|
||||
};
|
||||
|
||||
class GridNetConfigPage
|
||||
|
|
@ -56,8 +56,8 @@ public:
|
|||
GridNetConfigPage (QWidget *parent);
|
||||
~GridNetConfigPage ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::GridNetConfigPage *mp_ui;
|
||||
|
|
|
|||
|
|
@ -194,52 +194,6 @@ HCPCellTreeWidget::mouseReleaseEvent (QMouseEvent *event)
|
|||
|
||||
const int max_cellviews_in_split_mode = 5;
|
||||
|
||||
void
|
||||
HierarchyControlPanel::init_menu (lay::AbstractMenu &menu)
|
||||
{
|
||||
MenuLayoutEntry sorting_menu [] = {
|
||||
MenuLayoutEntry ("by_name", tl::to_string (QObject::tr ("By Name")), std::make_pair (cfg_cell_list_sorting, "?by-name")),
|
||||
MenuLayoutEntry ("by_area", tl::to_string (QObject::tr ("By Area - Small To Large")), std::make_pair (cfg_cell_list_sorting, "?by-area")),
|
||||
MenuLayoutEntry ("by_area", tl::to_string (QObject::tr ("By Area - Large To Small")), std::make_pair (cfg_cell_list_sorting, "?by-area-reverse")),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry context_menu [] = {
|
||||
MenuLayoutEntry ("flat_mode", tl::to_string (QObject::tr ("Flat Cell List")), std::make_pair (cfg_flat_cell_list, "?")),
|
||||
MenuLayoutEntry ("split_mode", tl::to_string (QObject::tr ("Split Mode")), std::make_pair (cfg_split_cell_list, "?")),
|
||||
MenuLayoutEntry ("sorting", tl::to_string (QObject::tr ("Sorting")), sorting_menu),
|
||||
MenuLayoutEntry::separator ("operations_group"),
|
||||
MenuLayoutEntry ("new_cell:edit:edit_mode", tl::to_string (QObject::tr ("New Cell")), SLOT (cm_new_cell ())),
|
||||
MenuLayoutEntry ("delete_cell:edit:edit_mode", tl::to_string (QObject::tr ("Delete Cell")), SLOT (cm_cell_delete ())),
|
||||
MenuLayoutEntry ("rename_cell:edit:edit_mode", tl::to_string (QObject::tr ("Rename Cell")), SLOT (cm_cell_rename ())),
|
||||
MenuLayoutEntry ("replace_cell:edit:edit_mode", tl::to_string (QObject::tr ("Replace Cell")), SLOT (cm_cell_replace ())),
|
||||
MenuLayoutEntry ("flatten_cell:edit:edit_mode", tl::to_string (QObject::tr ("Flatten Cell")), SLOT (cm_cell_flatten ())),
|
||||
MenuLayoutEntry ("cell_user_properties", tl::to_string (QObject::tr ("User Properties")), SLOT (cm_cell_user_properties ())),
|
||||
MenuLayoutEntry::separator ("clipboard_group:edit_mode"),
|
||||
MenuLayoutEntry ("copy:edit_mode", tl::to_string (QObject::tr ("Copy")), SLOT (cm_cell_copy ())),
|
||||
MenuLayoutEntry ("cut:edit_mode", tl::to_string (QObject::tr ("Cut")), SLOT (cm_cell_cut ())),
|
||||
MenuLayoutEntry ("paste:edit_mode", tl::to_string (QObject::tr ("Paste")), SLOT (cm_cell_paste ())),
|
||||
MenuLayoutEntry::separator ("select_group"),
|
||||
MenuLayoutEntry ("show_as_top", tl::to_string (QObject::tr ("Show As New Top")), SLOT (cm_cell_select ())),
|
||||
MenuLayoutEntry::separator ("visibility_group"),
|
||||
MenuLayoutEntry ("hide_cell", tl::to_string (QObject::tr ("Hide")), SLOT (cm_cell_hide ())),
|
||||
MenuLayoutEntry ("show_cell", tl::to_string (QObject::tr ("Show")), SLOT (cm_cell_show ())),
|
||||
MenuLayoutEntry ("show_all", tl::to_string (QObject::tr ("Show All")), SLOT (cm_cell_show_all ())),
|
||||
MenuLayoutEntry::separator ("utils_group"),
|
||||
MenuLayoutEntry ("open_current", tl::to_string (QObject::tr ("Where Am I?")), SLOT (cm_open_current_cell ())),
|
||||
MenuLayoutEntry::separator ("file_group"),
|
||||
MenuLayoutEntry ("save_cell_as:hide_vo", tl::to_string (QObject::tr ("Save Selected Cells As")), SLOT (cm_save_current_cell_as ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry main_menu [] = {
|
||||
MenuLayoutEntry ("@hcp_context_menu", "", context_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (main_menu);
|
||||
}
|
||||
|
||||
HierarchyControlPanel::HierarchyControlPanel (lay::LayoutView *view, QWidget *parent, const char *name)
|
||||
: QFrame (parent),
|
||||
m_enable_cb (true),
|
||||
|
|
@ -1204,4 +1158,57 @@ HierarchyControlPanel::paste ()
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class HierarchyControlPanelPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@hcp_context_menu", at, std::string ()));
|
||||
|
||||
at = "@hcp_context_menu.end";
|
||||
|
||||
menu_entries.push_back (lay::config_menu_item ("flat_mode", at, tl::to_string (QObject::tr ("Flat Cell List")), cfg_flat_cell_list, "?")),
|
||||
menu_entries.push_back (lay::config_menu_item ("split_mode", at, tl::to_string (QObject::tr ("Split Mode")), cfg_split_cell_list, "?")),
|
||||
menu_entries.push_back (lay::submenu ("sorting", at, tl::to_string (QObject::tr ("Sorting"))));
|
||||
|
||||
{
|
||||
std::string at = "@hcp_context_menu.sorting.end";
|
||||
menu_entries.push_back (lay::config_menu_item ("by_name", at, tl::to_string (QObject::tr ("By Name")), cfg_cell_list_sorting, "?by-name"));
|
||||
menu_entries.push_back (lay::config_menu_item ("by_area", at, tl::to_string (QObject::tr ("By Area - Small To Large")), cfg_cell_list_sorting, "?by-area"));
|
||||
menu_entries.push_back (lay::config_menu_item ("by_area", at, tl::to_string (QObject::tr ("By Area - Large To Small")), cfg_cell_list_sorting, "?by-area-reverse"));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("operations_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_new_cell", "new_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("New Cell")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_delete", "delete_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Delete Cell")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_rename", "rename_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Rename Cell")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_replace", "replace_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Replace Cell")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_flatten", "flatten_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Flatten Cell")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_user_properties", "cell_user_properties", at, tl::to_string (QObject::tr ("User Properties")));
|
||||
menu_entries.push_back (lay::separator ("clipboard_group:edit_mode", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_copy", "copy:edit_mode", at, tl::to_string (QObject::tr ("Copy")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_cut", "cut:edit_mode", at, tl::to_string (QObject::tr ("Cut")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_paste", "paste:edit_mode", at, tl::to_string (QObject::tr ("Paste")));
|
||||
menu_entries.push_back (lay::separator ("select_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_select", "show_as_top", at, tl::to_string (QObject::tr ("Show As New Top")));
|
||||
menu_entries.push_back (lay::separator ("visibility_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_hide", "hide_cell", at, tl::to_string (QObject::tr ("Hide")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_show", "show_cell", at, tl::to_string (QObject::tr ("Show")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_show_all", "show_all", at, tl::to_string (QObject::tr ("Show All")));
|
||||
menu_entries.push_back (lay::separator ("utils_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_open_current_cell", "open_current", at, tl::to_string (QObject::tr ("Where Am I?")));
|
||||
menu_entries.push_back (lay::separator ("file_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_save_current_cell_as", "save_cell_as:hide_vo", at, tl::to_string (QObject::tr ("Save Selected Cells As")));
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new HierarchyControlPanelPluginDeclaration (), -8, "HierarchyControlPanelPlugin");
|
||||
|
||||
} // namespace lay
|
||||
|
|
|
|||
|
|
@ -116,11 +116,6 @@ public:
|
|||
*/
|
||||
~HierarchyControlPanel ();
|
||||
|
||||
/**
|
||||
* @brief Perform the cell control panel's initialisations on the main menu
|
||||
*/
|
||||
static void init_menu (lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief The sizeHint implementation for Qt layout management
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -229,86 +229,6 @@ LCPTreeWidget::expand_all ()
|
|||
// --------------------------------------------------------------------
|
||||
// LayerControlPanel implementation
|
||||
|
||||
void
|
||||
LayerControlPanel::init_menu (lay::AbstractMenu &menu)
|
||||
{
|
||||
MenuLayoutEntry sort_by_menu [] = {
|
||||
MenuLayoutEntry ("sort_ild", tl::to_string (QObject::tr ("Layout Index, Layer And Datatype")), SLOT (cm_lv_sort_by_ild ())),
|
||||
MenuLayoutEntry ("sort_idl", tl::to_string (QObject::tr ("Layout Index, Datatype And Layer")), SLOT (cm_lv_sort_by_idl ())),
|
||||
MenuLayoutEntry ("sort_ldi", tl::to_string (QObject::tr ("Layer, Datatype And Layout Index")), SLOT (cm_lv_sort_by_ldi ())),
|
||||
MenuLayoutEntry ("sort_dli", tl::to_string (QObject::tr ("Datatype, Layer And Layout Index")), SLOT (cm_lv_sort_by_dli ())),
|
||||
MenuLayoutEntry ("sort_name", tl::to_string (QObject::tr ("Name")), SLOT (cm_lv_sort_by_name ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry regroup_menu [] = {
|
||||
MenuLayoutEntry ("grp_i", tl::to_string (QObject::tr ("By Layout Index")), SLOT (cm_lv_regroup_by_index ())),
|
||||
MenuLayoutEntry ("grp_d", tl::to_string (QObject::tr ("By Datatype")), SLOT (cm_lv_regroup_by_datatype ())),
|
||||
MenuLayoutEntry ("grp_l", tl::to_string (QObject::tr ("By Layer")), SLOT (cm_lv_regroup_by_layer ())),
|
||||
MenuLayoutEntry ("flatten", tl::to_string (QObject::tr ("Flatten")), SLOT (cm_lv_regroup_flatten ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry tab_menu [] = {
|
||||
MenuLayoutEntry ("new_tab", tl::to_string (QObject::tr ("New Tab")), SLOT (cm_lv_new_tab ())),
|
||||
MenuLayoutEntry ("remove_tab", tl::to_string (QObject::tr ("Remove Tab")), SLOT (cm_lv_remove_tab ())),
|
||||
MenuLayoutEntry ("rename_tab", tl::to_string (QObject::tr ("Rename Tab")), SLOT (cm_lv_rename_tab ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry context_menu [] = {
|
||||
MenuLayoutEntry ("select_all", tl::to_string (QObject::tr ("Select All")), SLOT (cm_lv_select_all ())),
|
||||
// It is not sure, whether "expandAll" destabilizes the tree widget:
|
||||
// MenuLayoutEntry ("expand_all", tl::to_string (QObject::tr ("Expand All")), SLOT (cm_lv_expand_all ())),
|
||||
MenuLayoutEntry::separator ("tab_group"),
|
||||
MenuLayoutEntry ("tab_menu", tl::to_string (QObject::tr ("Tabs")), tab_menu),
|
||||
MenuLayoutEntry::separator ("visibility_group"),
|
||||
MenuLayoutEntry ("hide", tl::to_string (QObject::tr ("Hide")), SLOT (cm_lv_hide ())),
|
||||
MenuLayoutEntry ("hide_all", tl::to_string (QObject::tr ("Hide All")), SLOT (cm_lv_hide_all ())),
|
||||
MenuLayoutEntry ("show", tl::to_string (QObject::tr ("Show")), SLOT (cm_lv_show ())),
|
||||
MenuLayoutEntry ("show_all", tl::to_string (QObject::tr ("Show All")), SLOT (cm_lv_show_all ())),
|
||||
MenuLayoutEntry ("show_only", tl::to_string (QObject::tr ("Show Only Selected")), SLOT (cm_lv_show_only ())),
|
||||
MenuLayoutEntry ("valid", tl::to_string (QObject::tr ("Make Valid")), SLOT (cm_lv_make_valid ())),
|
||||
MenuLayoutEntry ("invvalid", tl::to_string (QObject::tr ("Make Invalid")), SLOT (cm_lv_make_invalid ())),
|
||||
MenuLayoutEntry ("rename", tl::to_string (QObject::tr ("Rename")), SLOT (cm_lv_rename ())),
|
||||
MenuLayoutEntry::separator ("options_group"),
|
||||
MenuLayoutEntry ("hide_empty_layers", tl::to_string (QObject::tr ("Hide Empty Layers")), std::make_pair (cfg_hide_empty_layers, "?")),
|
||||
MenuLayoutEntry ("test_shapes_in_view", tl::to_string (QObject::tr ("Test For Shapes In View")), std::make_pair (cfg_test_shapes_in_view, "?")),
|
||||
MenuLayoutEntry::separator ("source_group"),
|
||||
MenuLayoutEntry ("select_source", tl::to_string (QObject::tr ("Select Source")), SLOT (cm_lv_source ())),
|
||||
MenuLayoutEntry::separator ("sort_group"),
|
||||
MenuLayoutEntry ("sort_menu", tl::to_string (QObject::tr ("Sort By")), sort_by_menu),
|
||||
MenuLayoutEntry::separator ("view_group"),
|
||||
MenuLayoutEntry ("del", tl::to_string (QObject::tr ("Delete Layer Entry")), SLOT (cm_lv_delete ())),
|
||||
MenuLayoutEntry ("insert", tl::to_string (QObject::tr ("Insert Layer Entry")), SLOT (cm_lv_insert ())),
|
||||
MenuLayoutEntry ("add_others", tl::to_string (QObject::tr ("Add Other Layer Entries")), SLOT (cm_lv_add_missing ())),
|
||||
MenuLayoutEntry ("clean_up", tl::to_string (QObject::tr ("Clean Up Layer Entries")), SLOT (cm_lv_remove_unused ())),
|
||||
MenuLayoutEntry::separator ("grouping_group"),
|
||||
MenuLayoutEntry ("group", tl::to_string (QObject::tr ("Group")), SLOT (cm_lv_group ())),
|
||||
MenuLayoutEntry ("ungroup", tl::to_string (QObject::tr ("Ungroup")), SLOT (cm_lv_ungroup ())),
|
||||
MenuLayoutEntry ("regroup_menu", tl::to_string (QObject::tr ("Regroup Layer Entries")), regroup_menu),
|
||||
MenuLayoutEntry::separator ("copy_paste_group"),
|
||||
MenuLayoutEntry ("copy", tl::to_string (QObject::tr ("Copy")), SLOT (cm_lv_copy ())),
|
||||
MenuLayoutEntry ("cut", tl::to_string (QObject::tr ("Cut")), SLOT (cm_lv_cut ())),
|
||||
MenuLayoutEntry ("paste", tl::to_string (QObject::tr ("Paste")), SLOT (cm_lv_paste ())),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry lcp_context_menu [] = {
|
||||
MenuLayoutEntry ("@lcp_context_menu", "", context_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (lcp_context_menu);
|
||||
|
||||
MenuLayoutEntry lcp_tab_context_menu [] = {
|
||||
MenuLayoutEntry ("@lcp_tabs_context_menu", "", tab_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (lcp_tab_context_menu);
|
||||
}
|
||||
|
||||
LayerControlPanel::LayerControlPanel (lay::LayoutView *view, db::Manager *manager, QWidget *parent, const char *name)
|
||||
: QFrame (parent),
|
||||
db::Object (manager),
|
||||
|
|
@ -2399,4 +2319,96 @@ LayerControlPanel::do_move (int mode)
|
|||
mp_view->set_selected_layers (new_sel);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class LayerControlPanelPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@lcp_context_menu", at, std::string ()));
|
||||
|
||||
at = "@lcp_context_menu.end";
|
||||
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_select_all", "select_all", at, tl::to_string (QObject::tr ("Select All")));
|
||||
// It is not sure, whether "expandAll" destabilizes the tree widget:
|
||||
// menu_entries.push_back (lay::menu_item ("cm_lv_expand_all", "expand_all", at, tl::to_string (QObject::tr ("Expand All")));
|
||||
menu_entries.push_back (lay::separator ("tab_group", at));
|
||||
menu_entries.push_back (lay::submenu ("tab_menu", at, tl::to_string (QObject::tr ("Tabs"))));
|
||||
|
||||
{
|
||||
std::string at = "@lcp_context_menu.tab_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_new_tab", "new_tab", at, tl::to_string (QObject::tr ("New Tab")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_remove_tab", "remove_tab", at, tl::to_string (QObject::tr ("Remove Tab")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_rename_tab", "rename_tab", at, tl::to_string (QObject::tr ("Rename Tab")));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("visibility_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_hide", "hide", at, tl::to_string (QObject::tr ("Hide")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_hide_all", "hide_all", at, tl::to_string (QObject::tr ("Hide All")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_show", "show", at, tl::to_string (QObject::tr ("Show")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_show_all", "show_all", at, tl::to_string (QObject::tr ("Show All")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_show_only", "show_only", at, tl::to_string (QObject::tr ("Show Only Selected")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_make_valid", "valid", at, tl::to_string (QObject::tr ("Make Valid")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_make_invalid", "invvalid", at, tl::to_string (QObject::tr ("Make Invalid")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_rename", "rename", at, tl::to_string (QObject::tr ("Rename")));
|
||||
menu_entries.push_back (lay::separator ("options_group", at));
|
||||
menu_entries.push_back (lay::config_menu_item ("hide_empty_layers", at, tl::to_string (QObject::tr ("Hide Empty Layers")), cfg_hide_empty_layers, "?"));
|
||||
menu_entries.push_back (lay::config_menu_item ("test_shapes_in_view", at, tl::to_string (QObject::tr ("Test For Shapes In View")), cfg_test_shapes_in_view, "?"));
|
||||
menu_entries.push_back (lay::separator ("source_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_source", "select_source", at, tl::to_string (QObject::tr ("Select Source")));
|
||||
menu_entries.push_back (lay::separator ("sort_group", at));
|
||||
menu_entries.push_back (lay::submenu ("sort_menu", at, tl::to_string (QObject::tr ("Sort By"))));
|
||||
|
||||
{
|
||||
std::string at = "@lcp_context_menu.sort_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_sort_by_ild", "sort_ild", at, tl::to_string (QObject::tr ("Layout Index, Layer And Datatype")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_sort_by_idl", "sort_idl", at, tl::to_string (QObject::tr ("Layout Index, Datatype And Layer")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_sort_by_ldi", "sort_ldi", at, tl::to_string (QObject::tr ("Layer, Datatype And Layout Index")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_sort_by_dli", "sort_dli", at, tl::to_string (QObject::tr ("Datatype, Layer And Layout Index")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_sort_by_name", "sort_name", at, tl::to_string (QObject::tr ("Name")));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("view_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_delete", "del", at, tl::to_string (QObject::tr ("Delete Layer Entry")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_insert", "insert", at, tl::to_string (QObject::tr ("Insert Layer Entry")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_add_missing", "add_others", at, tl::to_string (QObject::tr ("Add Other Layer Entries")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_remove_unused", "clean_up", at, tl::to_string (QObject::tr ("Clean Up Layer Entries")));
|
||||
menu_entries.push_back (lay::separator ("grouping_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_group", "group", at, tl::to_string (QObject::tr ("Group")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_ungroup", "ungroup", at, tl::to_string (QObject::tr ("Ungroup")));
|
||||
menu_entries.push_back (lay::submenu ("regroup_menu", at, tl::to_string (QObject::tr ("Regroup Layer Entries"))));
|
||||
|
||||
{
|
||||
std::string at = "@lcp_context_menu.regroup_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_regroup_by_index", "grp_i", at, tl::to_string (QObject::tr ("By Layout Index")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_regroup_by_datatype", "grp_d", at, tl::to_string (QObject::tr ("By Datatype")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_regroup_by_layer", "grp_l", at, tl::to_string (QObject::tr ("By Layer")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_regroup_flatten", "flatten", at, tl::to_string (QObject::tr ("Flatten")));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("copy_paste_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_copy", "copy", at, tl::to_string (QObject::tr ("Copy")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_cut", "cut", at, tl::to_string (QObject::tr ("Cut")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_paste", "paste", at, tl::to_string (QObject::tr ("Paste")));
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@lcp_tabs_context_menu", at, std::string ()));
|
||||
|
||||
{
|
||||
std::string at = "@lcp_tabs_context_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_new_tab", "new_tab", at, tl::to_string (QObject::tr ("New Tab")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_remove_tab", "remove_tab", at, tl::to_string (QObject::tr ("Remove Tab")));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lv_rename_tab", "rename_tab", at, tl::to_string (QObject::tr ("Rename Tab")));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new LayerControlPanelPluginDeclaration (), -9, "LayerControlPanelPlugin");
|
||||
|
||||
} // namespace lay
|
||||
|
|
|
|||
|
|
@ -138,11 +138,6 @@ public:
|
|||
*/
|
||||
bool has_focus () const;
|
||||
|
||||
/**
|
||||
* @brief Perform the layer control panel's initialisations on the main menu
|
||||
*/
|
||||
static void init_menu (lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief Tell, if there is something to copy
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@
|
|||
#include "tlAssert.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "layLayoutView.h"
|
||||
#include "layAbstractMenuProvider.h"
|
||||
#include "layViewOp.h"
|
||||
#include "layViewObject.h"
|
||||
#include "layLayoutViewConfigPages.h"
|
||||
|
|
@ -70,6 +69,11 @@
|
|||
#include "layBookmarkManagementForm.h"
|
||||
#include "layNetlistBrowserDialog.h"
|
||||
#include "layBookmarksView.h"
|
||||
#include "laySelectCellViewForm.h"
|
||||
#include "layCellSelectionForm.h"
|
||||
#include "layLayoutPropertiesForm.h"
|
||||
#include "layLayoutStatisticsForm.h"
|
||||
#include "dbClipboard.h"
|
||||
#include "dbLayout.h"
|
||||
#include "dbLayoutUtils.h"
|
||||
#include "dbRecursiveShapeIterator.h"
|
||||
|
|
@ -255,35 +259,33 @@ static LayoutView *ms_current = 0;
|
|||
|
||||
LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin_parent, QWidget *parent, const char *name, unsigned int options)
|
||||
: QFrame (parent),
|
||||
lay::Plugin (plugin_parent),
|
||||
lay::AbstractMenuProvider (false /* don't register as global instance */),
|
||||
m_menu (this),
|
||||
lay::Dispatcher (plugin_parent, false /*not standalone*/),
|
||||
m_editable (editable),
|
||||
m_options (options),
|
||||
m_annotation_shapes (manager),
|
||||
dm_prop_changed (this, &LayoutView::do_prop_changed)
|
||||
{
|
||||
if (! plugin_root_maybe_null ()) {
|
||||
mp_plugin_root.reset (new lay::PluginRoot (true, false));
|
||||
}
|
||||
// either it's us or the parent has a dispatcher
|
||||
tl_assert (dispatcher () != 0);
|
||||
|
||||
// ensures the deferred method scheduler is present
|
||||
tl::DeferredMethodScheduler::instance ();
|
||||
|
||||
setObjectName (QString::fromUtf8 (name));
|
||||
init (manager, plugin_root_maybe_null () ? plugin_root_maybe_null () : mp_plugin_root.get (), parent);
|
||||
init (manager, dispatcher (), parent);
|
||||
}
|
||||
|
||||
LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::PluginRoot *root, QWidget *parent, const char *name, unsigned int options)
|
||||
LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, QWidget *parent, const char *name, unsigned int options)
|
||||
: QFrame (parent),
|
||||
lay::Plugin (root),
|
||||
lay::AbstractMenuProvider (false /* don't register as global instance */),
|
||||
m_menu (this),
|
||||
lay::Dispatcher (plugin_parent, false /*not standalone*/),
|
||||
m_editable (editable),
|
||||
m_options (options),
|
||||
m_annotation_shapes (manager),
|
||||
dm_prop_changed (this, &LayoutView::do_prop_changed)
|
||||
{
|
||||
// either it's us or the parent has a dispatcher
|
||||
tl_assert (dispatcher () != 0);
|
||||
|
||||
// ensures the deferred method scheduler is present
|
||||
tl::DeferredMethodScheduler::instance ();
|
||||
|
||||
|
|
@ -291,7 +293,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit
|
|||
|
||||
m_annotation_shapes = source->m_annotation_shapes;
|
||||
|
||||
init (manager, root, parent);
|
||||
init (manager, dispatcher (), parent);
|
||||
|
||||
// set the handle reference and clear all cell related stuff
|
||||
m_cellviews = source->cellview_list ();
|
||||
|
|
@ -353,14 +355,13 @@ LayoutView::eventFilter(QObject *obj, QEvent *event)
|
|||
}
|
||||
|
||||
void
|
||||
LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
|
||||
LayoutView::init (db::Manager *mgr, lay::Dispatcher *dispatcher, QWidget * /*parent*/)
|
||||
{
|
||||
manager (mgr);
|
||||
|
||||
if (! lay::AbstractMenuProvider::instance () || ! lay::AbstractMenuProvider::instance ()->menu ()) {
|
||||
init_menu (m_menu);
|
||||
if (! dispatcher) {
|
||||
// build the context menus, nothing else so far.
|
||||
m_menu.build (0, 0);
|
||||
menu ()->build (0, 0);
|
||||
}
|
||||
|
||||
m_annotation_shapes.manager (mgr);
|
||||
|
|
@ -597,9 +598,7 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
|
|||
connect (mp_timer, SIGNAL (timeout ()), this, SLOT (timer ()));
|
||||
mp_timer->start (timer_interval);
|
||||
|
||||
if (root) {
|
||||
create_plugins (root);
|
||||
}
|
||||
create_plugins ();
|
||||
|
||||
m_new_layer_props.layer = 1;
|
||||
m_new_layer_props.datatype = 0;
|
||||
|
|
@ -704,62 +703,6 @@ QWidget *LayoutView::menu_parent_widget ()
|
|||
return this;
|
||||
}
|
||||
|
||||
lay::Action &
|
||||
LayoutView::action_for_slot (const char *slot)
|
||||
{
|
||||
std::map<std::string, lay::Action>::iterator a = m_actions_for_slot.find (std::string (slot));
|
||||
if (a != m_actions_for_slot.end ()) {
|
||||
return a->second;
|
||||
} else {
|
||||
Action a = Action::create_free_action (this);
|
||||
gtf::action_connect (a.qaction (), SIGNAL (triggered ()), this, slot);
|
||||
return m_actions_for_slot.insert (std::make_pair (std::string (slot), a)).first->second;
|
||||
}
|
||||
}
|
||||
|
||||
lay::Action *
|
||||
LayoutView::create_config_action (const std::string &title, const std::string &cname, const std::string &cvalue)
|
||||
{
|
||||
lay::ConfigureAction *ca = new lay::ConfigureAction (plugin_root (), title, cname, cvalue);
|
||||
m_ca_collection.push_back (ca);
|
||||
return ca;
|
||||
}
|
||||
|
||||
lay::Action *
|
||||
LayoutView::create_config_action (const std::string &cname, const std::string &cvalue)
|
||||
{
|
||||
lay::ConfigureAction *ca = new lay::ConfigureAction (plugin_root (), std::string (), cname, cvalue);
|
||||
m_ca_collection.push_back (ca);
|
||||
return ca;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::register_config_action (const std::string &name, lay::ConfigureAction *action)
|
||||
{
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> >::iterator ca = m_configuration_actions.insert (std::make_pair (name, std::vector<lay::ConfigureAction *> ())).first;
|
||||
for (std::vector<lay::ConfigureAction *>::iterator a = ca->second.begin (); a != ca->second.end (); ++a) {
|
||||
if (*a == action) {
|
||||
return; // already registered
|
||||
}
|
||||
}
|
||||
|
||||
ca->second.push_back (action);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::unregister_config_action (const std::string &name, lay::ConfigureAction *action)
|
||||
{
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> >::iterator ca = m_configuration_actions.find (name);
|
||||
if (ca != m_configuration_actions.end ()) {
|
||||
for (std::vector<lay::ConfigureAction *>::iterator a = ca->second.begin (); a != ca->second.end (); ++a) {
|
||||
if (*a == action) {
|
||||
ca->second.erase (a);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutView::side_panel_destroyed ()
|
||||
{
|
||||
if (sender () == mp_control_frame) {
|
||||
|
|
@ -859,9 +802,9 @@ void LayoutView::drop_url (const std::string &path_or_url)
|
|||
}
|
||||
}
|
||||
|
||||
lay::Plugin *LayoutView::create_plugin (lay::PluginRoot *root, const lay::PluginDeclaration *cls)
|
||||
lay::Plugin *LayoutView::create_plugin (const lay::PluginDeclaration *cls)
|
||||
{
|
||||
lay::Plugin *p = cls->create_plugin (manager (), root, this);
|
||||
lay::Plugin *p = cls->create_plugin (manager (), dispatcher (), this);
|
||||
if (p) {
|
||||
|
||||
// unhook the plugin from the script side if created there (prevent GC from destroying it)
|
||||
|
|
@ -881,7 +824,7 @@ lay::Plugin *LayoutView::create_plugin (lay::PluginRoot *root, const lay::Plugin
|
|||
return p;
|
||||
}
|
||||
|
||||
void LayoutView::create_plugins (lay::PluginRoot *root, const lay::PluginDeclaration *except_this)
|
||||
void LayoutView::create_plugins (const lay::PluginDeclaration *except_this)
|
||||
{
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
delete *p;
|
||||
|
|
@ -896,13 +839,13 @@ void LayoutView::create_plugins (lay::PluginRoot *root, const lay::PluginDeclara
|
|||
// TODO: clean solution. The following is a HACK:
|
||||
if (cls.current_name () == "ant::Plugin" || cls.current_name () == "img::Plugin") {
|
||||
// ant and img are created always
|
||||
create_plugin (root, &*cls);
|
||||
create_plugin (&*cls);
|
||||
} else if ((m_options & LV_NoPlugins) == 0) {
|
||||
// others: only create unless LV_NoPlugins is set
|
||||
create_plugin (root, &*cls);
|
||||
create_plugin (&*cls);
|
||||
} else if ((m_options & LV_NoGrid) == 0 && cls.current_name () == "GridNetPlugin") {
|
||||
// except grid net plugin which is created on request
|
||||
create_plugin (root, &*cls);
|
||||
create_plugin (&*cls);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -932,15 +875,6 @@ Plugin *LayoutView::get_plugin_by_name (const std::string &name) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::init_menu (lay::AbstractMenu &menu)
|
||||
{
|
||||
lay::LayerControlPanel::init_menu (menu);
|
||||
lay::HierarchyControlPanel::init_menu (menu);
|
||||
lay::LibrariesView::init_menu (menu);
|
||||
lay::BookmarksView::init_menu (menu);
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::update_menu (lay::LayoutView *view, lay::AbstractMenu &menu)
|
||||
{
|
||||
|
|
@ -1045,6 +979,8 @@ LayoutView::reset_title ()
|
|||
bool
|
||||
LayoutView::configure (const std::string &name, const std::string &value)
|
||||
{
|
||||
lay::Dispatcher::configure (name, value);
|
||||
|
||||
if (mp_move_service && mp_move_service->configure (name, value)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4773,7 +4709,7 @@ LayoutView::active_library_changed (int /*index*/)
|
|||
|
||||
// commit the new active library to the other views and persist this state
|
||||
// TODO: could be passed through the LibraryController (like through some LibraryController::active_library)
|
||||
plugin_root ()->config_set (cfg_current_lib_view, lib_name);
|
||||
dispatcher ()->config_set (cfg_current_lib_view, lib_name);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -6540,25 +6476,461 @@ LayoutView::intrinsic_mouse_modes (std::vector<std::string> *descriptions)
|
|||
AbstractMenu *
|
||||
LayoutView::menu ()
|
||||
{
|
||||
if (lay::AbstractMenuProvider::instance () && lay::AbstractMenuProvider::instance ()->menu ()) {
|
||||
return lay::AbstractMenuProvider::instance ()->menu ();
|
||||
} else {
|
||||
return &m_menu;
|
||||
}
|
||||
// NOTE: dispatcher is either this or the real end of the chain
|
||||
return dispatcher ()->menu ();
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
LayoutView::default_mode ()
|
||||
{
|
||||
return 0; // TODO: any generic scheme? is select, should be ruler..
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
LayoutView::do_cm_duplicate (bool interactive)
|
||||
{
|
||||
// Do duplicate simply by concatenating copy & paste currently.
|
||||
// Save the clipboard state before in order to preserve the current content
|
||||
db::Clipboard saved_clipboard;
|
||||
db::Clipboard::instance ().swap (saved_clipboard);
|
||||
|
||||
try {
|
||||
copy ();
|
||||
clear_selection ();
|
||||
cancel ();
|
||||
if (interactive) {
|
||||
paste_interactive ();
|
||||
} else {
|
||||
paste ();
|
||||
}
|
||||
db::Clipboard::instance ().swap (saved_clipboard);
|
||||
} catch (...) {
|
||||
db::Clipboard::instance ().swap (saved_clipboard);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::do_cm_paste (bool interactive)
|
||||
{
|
||||
if (! db::Clipboard::instance ().empty ()) {
|
||||
cancel ();
|
||||
clear_selection ();
|
||||
if (interactive) {
|
||||
paste_interactive ();
|
||||
} else {
|
||||
paste ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::cm_new_cell ()
|
||||
{
|
||||
static double s_new_cell_window_size = 2.0;
|
||||
static std::string s_new_cell_cell_name;
|
||||
|
||||
NewCellPropertiesDialog cell_prop_dia (this);
|
||||
if (cell_prop_dia.exec_dialog (& cellview (active_cellview_index ())->layout (), s_new_cell_cell_name, s_new_cell_window_size)) {
|
||||
|
||||
db::cell_index_type new_ci = new_cell (active_cellview_index (), s_new_cell_cell_name.c_str ());
|
||||
select_cell (new_ci, active_cellview_index ());
|
||||
|
||||
db::DBox zb = db::DBox (-0.5 * s_new_cell_window_size, -0.5 * s_new_cell_window_size, 0.5 * s_new_cell_window_size, 0.5 * s_new_cell_window_size);
|
||||
if (get_max_hier_levels () < 1 || get_min_hier_levels () > 0) {
|
||||
zoom_box_and_set_hier_levels (zb, std::make_pair (0, 1));
|
||||
} else {
|
||||
zoom_box (zb);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this constant is defined in MainWindow.cc too ...
|
||||
const int max_dirty_files = 15;
|
||||
|
||||
void
|
||||
LayoutView::cm_reload ()
|
||||
{
|
||||
std::vector <int> selected;
|
||||
|
||||
if (cellviews () > 1) {
|
||||
|
||||
SelectCellViewForm form (0, this, tl::to_string (QObject::tr ("Select Layouts To Reload")));
|
||||
form.select_all ();
|
||||
|
||||
if (form.exec () == QDialog::Accepted) {
|
||||
selected = form.selected_cellviews ();
|
||||
}
|
||||
|
||||
} else if (cellviews () > 0) {
|
||||
selected.push_back (0);
|
||||
}
|
||||
|
||||
if (selected.size () > 0) {
|
||||
|
||||
int dirty_layouts = 0;
|
||||
std::string dirty_files;
|
||||
|
||||
for (std::vector <int>::const_iterator i = selected.begin (); i != selected.end (); ++i) {
|
||||
|
||||
const lay::CellView &cv = cellview (*i);
|
||||
|
||||
if (cv->layout ().is_editable () && cv->is_dirty ()) {
|
||||
++dirty_layouts;
|
||||
if (dirty_layouts == max_dirty_files) {
|
||||
dirty_files += "\n...";
|
||||
} else if (dirty_layouts < max_dirty_files) {
|
||||
if (! dirty_files.empty ()) {
|
||||
dirty_files += "\n";
|
||||
}
|
||||
dirty_files += cv->name ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool can_reload = true;
|
||||
if (dirty_layouts != 0) {
|
||||
|
||||
QMessageBox mbox (this);
|
||||
mbox.setText (tl::to_qstring (tl::to_string (QObject::tr ("The following layouts need saving:\n\n")) + dirty_files + "\n\nPress 'Reload Without Saving' to reload anyhow and discard changes."));
|
||||
mbox.setWindowTitle (QObject::tr ("Save Needed"));
|
||||
mbox.setIcon (QMessageBox::Warning);
|
||||
QAbstractButton *yes_button = mbox.addButton (QObject::tr ("Reload Without Saving"), QMessageBox::YesRole);
|
||||
mbox.addButton (QMessageBox::Cancel);
|
||||
|
||||
mbox.exec ();
|
||||
|
||||
can_reload = (mbox.clickedButton() == yes_button);
|
||||
|
||||
}
|
||||
|
||||
if (can_reload) {
|
||||
|
||||
// Actually reload
|
||||
for (std::vector <int>::const_iterator i = selected.begin (); i != selected.end (); ++i) {
|
||||
reload_layout (*i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
LayoutView::menu_symbols ()
|
||||
{
|
||||
// TODO: currently these are all symbols from all plugins
|
||||
return lay::PluginDeclaration::menu_symbols ();
|
||||
}
|
||||
|
||||
void
|
||||
LayoutView::menu_activated (const std::string &symbol)
|
||||
{
|
||||
// distribute the menu on the plugins - one should take it.
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
(*p)->menu_activated (symbol);
|
||||
if (symbol == "cm_show_properties") {
|
||||
show_properties (this);
|
||||
} else if (symbol == "cm_delete") {
|
||||
|
||||
del ();
|
||||
// because a "delete" might involve objects currently edited, we cancel the edit after we have deleted the object
|
||||
cancel ();
|
||||
clear_selection ();
|
||||
|
||||
} else if (symbol == "cm_unselect_all") {
|
||||
select (db::DBox (), lay::Editable::Reset);
|
||||
} else if (symbol == "cm_select_all") {
|
||||
select (full_box (), lay::Editable::Replace);
|
||||
} else if (symbol == "cm_lv_paste") {
|
||||
cm_layer_paste ();
|
||||
} else if (symbol == "cm_lv_cut") {
|
||||
cm_layer_cut ();
|
||||
} else if (symbol == "cm_lv_copy") {
|
||||
cm_layer_copy ();
|
||||
} else if (symbol == "cm_cell_paste") {
|
||||
cm_cell_paste ();
|
||||
} else if (symbol == "cm_cell_cut") {
|
||||
cm_cell_cut ();
|
||||
} else if (symbol == "cm_cell_copy") {
|
||||
cm_cell_copy ();
|
||||
} else if (symbol == "cm_duplicate") {
|
||||
do_cm_duplicate (false);
|
||||
} else if (symbol == "cm_duplicate_interactive") {
|
||||
do_cm_duplicate (true);
|
||||
} else if (symbol == "cm_copy") {
|
||||
|
||||
copy ();
|
||||
clear_selection ();
|
||||
|
||||
} else if (symbol == "cm_paste") {
|
||||
do_cm_paste (true);
|
||||
} else if (symbol == "cm_paste_interactive") {
|
||||
do_cm_paste (true);
|
||||
} else if (symbol == "cm_cut") {
|
||||
|
||||
cut ();
|
||||
cancel (); // see del() for reason why cancel is after cut
|
||||
clear_selection ();
|
||||
|
||||
} else if (symbol == "cm_zoom_fit_sel") {
|
||||
zoom_fit_sel ();
|
||||
} else if (symbol == "cm_zoom_fit") {
|
||||
zoom_fit ();
|
||||
} else if (symbol == "cm_pan_left") {
|
||||
pan_left ();
|
||||
} else if (symbol == "cm_pan_right") {
|
||||
pan_right ();
|
||||
} else if (symbol == "cm_pan_up") {
|
||||
pan_up ();
|
||||
} else if (symbol == "cm_pan_down") {
|
||||
pan_down ();
|
||||
} else if (symbol == "cm_zoom_in") {
|
||||
zoom_in ();
|
||||
} else if (symbol == "cm_zoom_out") {
|
||||
zoom_out ();
|
||||
} else if (symbol == "cm_select_current_cell") {
|
||||
|
||||
if (active_cellview_index () >= 0) {
|
||||
lay::LayoutView::cell_path_type path;
|
||||
int cvi = active_cellview_index ();
|
||||
current_cell_path (path);
|
||||
select_cell_fit (path, cvi);
|
||||
}
|
||||
|
||||
} else if (symbol == "cm_open_current_cell") {
|
||||
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_open_current_cell ();
|
||||
}
|
||||
|
||||
} else if (symbol == "cm_select_cell") {
|
||||
|
||||
if (active_cellview_index () >= 0) {
|
||||
|
||||
CellSelectionForm form (0, this, "cell_selection_form");
|
||||
|
||||
if (form.exec () == QDialog::Accepted &&
|
||||
form.selected_cellview_index () >= 0) {
|
||||
select_cell (form.selected_cellview ().combined_unspecific_path (), form.selected_cellview_index ());
|
||||
set_current_cell_path (form.selected_cellview_index (), form.selected_cellview ().combined_unspecific_path ());
|
||||
zoom_fit ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (symbol == "cm_new_cell") {
|
||||
cm_new_cell ();
|
||||
} else if (symbol == "cm_adjust_origin") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_align_cell_origin ();
|
||||
}
|
||||
} else if (symbol == "cm_cell_convert_to_static") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_cell_convert_to_static ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_convert_to_static") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_convert_to_static ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_move") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_move ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_scale") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_scale ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_free_rot") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_free_rot ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_rot_ccw") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_rot_ccw ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_rot_cw") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_rot_cw ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_flip_y") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_flip_y ();
|
||||
}
|
||||
} else if (symbol == "cm_lay_flip_x") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_lay_flip_x ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_move") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_move ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_move_to") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_move_to ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_move_interactive") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_move_interactive ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_scale") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_scale ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_free_rot") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_free_rot ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_rot_ccw") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_rot_ccw ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_rot_cw") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_rot_cw ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_flip_y") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_flip_y ();
|
||||
}
|
||||
} else if (symbol == "cm_sel_flip_x") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_sel_flip_x ();
|
||||
}
|
||||
} else if (symbol == "cm_edit_layer") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_edit_layer ();
|
||||
}
|
||||
} else if (symbol == "cm_delete_layer") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_edit_layer ();
|
||||
}
|
||||
} else if (symbol == "cm_clear_layer") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_clear_layer ();
|
||||
}
|
||||
} else if (symbol == "cm_copy_layer") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_copy_layer ();
|
||||
}
|
||||
} else if (symbol == "cm_new_layer") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_new_layer ();
|
||||
}
|
||||
} else if (symbol == "cm_layout_props") {
|
||||
LayoutPropertiesForm lp_form (this, this, "layout_props_form");
|
||||
lp_form.exec ();
|
||||
} else if (symbol == "cm_layout_stats") {
|
||||
LayoutStatisticsForm lp_form (this, this, "layout_props_form");
|
||||
lp_form.exec ();
|
||||
} else if (symbol == "cm_reload") {
|
||||
cm_reload ();
|
||||
} else if (symbol == "cm_inc_max_hier") {
|
||||
int new_to = get_max_hier_levels () + 1;
|
||||
set_hier_levels (std::make_pair (get_min_hier_levels (), new_to));
|
||||
} else if (symbol == "cm_dec_max_hier") {
|
||||
int new_to = get_max_hier_levels () > 0 ? get_max_hier_levels () - 1 : 0;
|
||||
set_hier_levels (std::make_pair (std::min (get_min_hier_levels (), new_to), new_to));
|
||||
} else if (symbol == "cm_max_hier") {
|
||||
max_hier ();
|
||||
} else if (symbol == "cm_max_hier_0") {
|
||||
set_hier_levels (std::make_pair (std::min (get_min_hier_levels (), 0), 0));
|
||||
} else if (symbol == "cm_max_hier_1") {
|
||||
set_hier_levels (std::make_pair (std::min (get_min_hier_levels (), 0), 1));
|
||||
} else if (symbol == "cm_prev_display_state") {
|
||||
if (has_prev_display_state ()) {
|
||||
prev_display_state ();
|
||||
}
|
||||
} else if (symbol == "cm_next_display_state") {
|
||||
if (has_next_display_state ()) {
|
||||
next_display_state ();
|
||||
}
|
||||
} else if (symbol == "cm_redraw") {
|
||||
redraw ();
|
||||
} else if (symbol == "cm_cell_delete") {
|
||||
cm_cell_delete ();
|
||||
} else if (symbol == "cm_cell_replace") {
|
||||
cm_cell_replace ();
|
||||
} else if (symbol == "cm_cell_rename") {
|
||||
cm_cell_rename ();
|
||||
} else if (symbol == "cm_cell_flatten") {
|
||||
cm_cell_flatten ();
|
||||
} else if (symbol == "cm_cell_select") {
|
||||
cm_cell_select ();
|
||||
} else if (symbol == "cm_cell_hide") {
|
||||
cm_cell_hide ();
|
||||
} else if (symbol == "cm_cell_show") {
|
||||
cm_cell_show ();
|
||||
} else if (symbol == "cm_cell_show_all") {
|
||||
cm_cell_show_all ();
|
||||
} else if (symbol == "cm_cell_user_properties") {
|
||||
if (active_cellview_index () >= 0) {
|
||||
cm_cell_user_properties ();
|
||||
}
|
||||
} else if (symbol == "cm_lv_select_all") {
|
||||
cm_select_all ();
|
||||
} else if (symbol == "cm_lv_new_tab") {
|
||||
cm_new_tab ();
|
||||
} else if (symbol == "cm_lv_rename_tab") {
|
||||
cm_rename_tab ();
|
||||
} else if (symbol == "cm_lv_make_invalid") {
|
||||
cm_make_invalid ();
|
||||
} else if (symbol == "cm_lv_remove_tab") {
|
||||
cm_remove_tab ();
|
||||
} else if (symbol == "cm_lv_make_valid") {
|
||||
cm_make_valid ();
|
||||
} else if (symbol == "cm_lv_hide_all") {
|
||||
cm_hide_all ();
|
||||
} else if (symbol == "cm_lv_hide") {
|
||||
cm_hide ();
|
||||
} else if (symbol == "cm_lv_show_only") {
|
||||
cm_show_only ();
|
||||
} else if (symbol == "cm_lv_show_all") {
|
||||
cm_show_all ();
|
||||
} else if (symbol == "cm_lv_show") {
|
||||
cm_show ();
|
||||
} else if (symbol == "cm_lv_rename") {
|
||||
cm_rename ();
|
||||
} else if (symbol == "cm_lv_delete") {
|
||||
cm_delete ();
|
||||
} else if (symbol == "cm_lv_insert") {
|
||||
cm_insert ();
|
||||
} else if (symbol == "cm_lv_group") {
|
||||
cm_group ();
|
||||
} else if (symbol == "cm_lv_ungroup") {
|
||||
cm_ungroup ();
|
||||
} else if (symbol == "cm_lv_source") {
|
||||
cm_source ();
|
||||
} else if (symbol == "cm_lv_sort_by_name") {
|
||||
cm_sort_by_name ();
|
||||
} else if (symbol == "cm_lv_sort_by_ild") {
|
||||
cm_sort_by_ild ();
|
||||
} else if (symbol == "cm_lv_sort_by_idl") {
|
||||
cm_sort_by_idl ();
|
||||
} else if (symbol == "cm_lv_sort_by_ldi") {
|
||||
cm_sort_by_ldi ();
|
||||
} else if (symbol == "cm_lv_sort_by_dli") {
|
||||
cm_sort_by_dli ();
|
||||
} else if (symbol == "cm_lv_regroup_by_index") {
|
||||
cm_regroup_by_index ();
|
||||
} else if (symbol == "cm_lv_regroup_by_datatype") {
|
||||
cm_regroup_by_datatype ();
|
||||
} else if (symbol == "cm_lv_regroup_by_layer") {
|
||||
cm_regroup_by_layer ();
|
||||
} else if (symbol == "cm_lv_regroup_flatten") {
|
||||
cm_regroup_flatten ();
|
||||
} else if (symbol == "cm_lv_expand_all") {
|
||||
cm_expand_all ();
|
||||
} else if (symbol == "cm_lv_add_missing") {
|
||||
cm_add_missing ();
|
||||
} else if (symbol == "cm_lv_remove_unused") {
|
||||
cm_remove_unused ();
|
||||
} else {
|
||||
|
||||
// distribute the menu on the plugins - one should take it.
|
||||
for (std::vector<lay::Plugin *>::iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
(*p)->menu_activated (symbol);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7596,5 +7968,186 @@ LayoutView::sizeHint () const
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace lay
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class LayoutViewPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
// secret menu entries
|
||||
at = "@secrets.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_paste_interactive", "paste_interactive:edit", at, tl::to_string (QObject::tr ("Paste Interactive"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_duplicate_interactive", "duplicate_interactive:edit", at, tl::to_string (QObject::tr ("Duplicate Interactive"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_move_interactive", "sel_move_interactive:edit", at, tl::to_string (QObject::tr ("Move Interactive"))));
|
||||
|
||||
at = "edit_menu.end";
|
||||
menu_entries.push_back (lay::separator ("edit_select_individual_group", at));
|
||||
|
||||
menu_entries.push_back (lay::separator ("basic_group", at));
|
||||
menu_entries.push_back (lay::submenu ("layout_menu:edit:edit_mode", at, tl::to_string (QObject::tr ("Layout"))));
|
||||
{
|
||||
std::string at = "edit_menu.layout_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_flip_x", "lay_flip_x:edit_mode", at, tl::to_string (QObject::tr ("Flip Horizontally"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_flip_y", "lay_flip_y:edit_mode", at, tl::to_string (QObject::tr ("Flip Vertically"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_rot_cw", "lay_rot_cw:edit_mode", at, tl::to_string (QObject::tr ("Rotate Clockwise"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_rot_ccw", "lay_rot_ccw:edit_mode", at, tl::to_string (QObject::tr ("Rotate Counterclockwise"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_free_rot", "lay_free_rot:edit_mode", at, tl::to_string (QObject::tr ("Rotation By Angle"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_scale", "lay_scale:edit_mode", at, tl::to_string (QObject::tr ("Scale"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_move", "lay_move:edit_mode", at, tl::to_string (QObject::tr ("Move By"))));
|
||||
menu_entries.push_back (lay::separator ("cellop_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_lay_convert_to_static", "lay_convert_to_static:edit_mode", at, tl::to_string (QObject::tr ("Convert All Cells To Static"))));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::submenu ("cell_menu:edit:edit_mode", at, tl::to_string (QObject::tr ("Cell"))));
|
||||
{
|
||||
std::string at = "edit_menu.cell_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_new_cell", "new_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("New Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_delete", "delete_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Delete Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_rename", "rename_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Rename Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_replace", "replace_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Replace Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_flatten", "flatten_cell:edit:edit_mode", at, tl::to_string (QObject::tr ("Flatten Cell"))));
|
||||
menu_entries.push_back (lay::separator ("ops_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_adjust_origin", "adjust_cell_origin:edit:edit_mode", at, tl::to_string (QObject::tr ("Adjust Origin"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_convert_to_static", "convert_cell_to_static:edit_mode", at, tl::to_string (QObject::tr ("Convert Cell To Static"))));
|
||||
menu_entries.push_back (lay::separator ("props_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cell_user_properties", "user_properties", at, tl::to_string (QObject::tr ("User Properties"))));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::submenu ("layer_menu:edit:edit_mode", at, tl::to_string (QObject::tr ("Layer"))));
|
||||
{
|
||||
std::string at = "edit_menu.layer_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_new_layer", "new_layer:edit:edit_mode", at, tl::to_string (QObject::tr ("New Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_clear_layer", "clear_layer:edit:edit_mode", at, tl::to_string (QObject::tr ("Clear Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_delete_layer", "delete_layer:edit:edit_mode", at, tl::to_string (QObject::tr ("Delete Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_copy_layer", "copy_layer:edit:edit_mode", at, tl::to_string (QObject::tr ("Copy Layer"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_edit_layer", "edit_layer:edit:edit_mode", at, tl::to_string (QObject::tr ("Edit Layer Specification"))));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::submenu ("selection_menu:edit", at, tl::to_string (QObject::tr ("Selection"))));
|
||||
{
|
||||
std::string at = "edit_menu.selection_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_flip_x", "sel_flip_x", at, tl::to_string (QObject::tr ("Flip Horizontally"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_flip_y", "sel_flip_y", at, tl::to_string (QObject::tr ("Flip Vertically"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_rot_cw", "sel_rot_cw", at, tl::to_string (QObject::tr ("Rotate Clockwise"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_rot_ccw", "sel_rot_ccw", at, tl::to_string (QObject::tr ("Rotate Counterclockwise"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_free_rot", "sel_free_rot", at, tl::to_string (QObject::tr ("Rotation By Angle"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_scale", "sel_scale", at, tl::to_string (QObject::tr ("Scale"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_move", "sel_move", at, tl::to_string (QObject::tr ("Move By"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_sel_move_to", "sel_move_to", at, tl::to_string (QObject::tr ("Move To"))));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("edit_select_individual_group", at));
|
||||
|
||||
menu_entries.push_back (lay::separator ("utils_group", at));
|
||||
menu_entries.push_back (lay::submenu ("utils_menu:edit:edit_mode", at, tl::to_string (QObject::tr ("Utilities"))));
|
||||
|
||||
menu_entries.push_back (lay::separator ("edit_select_individual_group", at));
|
||||
|
||||
menu_entries.push_back (lay::separator ("misc_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_delete", "delete:edit", at, tl::to_string (QObject::tr ("Delete(Del)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_show_properties", "show_properties:edit", at, tl::to_string (QObject::tr ("Properties(Q)"))));
|
||||
menu_entries.push_back (lay::separator ("edit_select_individual_group", at));
|
||||
|
||||
menu_entries.push_back (lay::separator ("cpc_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_copy", "copy:edit", at, tl::to_string (QObject::tr ("Copy(Ctrl+C)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cut", "cut:edit", at, tl::to_string (QObject::tr ("Cut(Ctrl+X)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_paste", "paste:edit", at, tl::to_string (QObject::tr ("Paste(Ctrl+V)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_duplicate", "duplicate:edit", at, tl::to_string (QObject::tr ("Duplicate(Ctrl+B)"))));
|
||||
|
||||
menu_entries.push_back (lay::separator ("modes_group", at));
|
||||
menu_entries.push_back (lay::submenu ("mode_menu", at, tl::to_string (QObject::tr ("Mode"))));
|
||||
|
||||
menu_entries.push_back (lay::submenu ("select_menu", at, tl::to_string (QObject::tr ("Select"))));
|
||||
{
|
||||
std::string at = "edit_menu.select_menu.end";
|
||||
menu_entries.push_back (lay::menu_item ("cm_select_all", "select_all", at, tl::to_string (QObject::tr ("Select All"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_unselect_all", "unselect_all", at, tl::to_string (QObject::tr ("Unselect All"))));
|
||||
menu_entries.push_back (lay::separator ("edit_select_basic_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("enable_all", "enable_all", at, tl::to_string (QObject::tr ("Enable All"))));
|
||||
menu_entries.push_back (lay::menu_item ("disable_all", "disable_all", at, tl::to_string (QObject::tr ("Disable All"))));
|
||||
menu_entries.push_back (lay::separator ("edit_select_individual_group", at));
|
||||
};
|
||||
|
||||
menu_entries.push_back (lay::separator ("cancel_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_cancel", "cancel", at, tl::to_string (QObject::tr ("Cancel(Esc)"))));
|
||||
|
||||
at = "bookmark_menu.end";
|
||||
menu_entries.push_back (lay::submenu ("goto_bookmark_menu", at, tl::to_string (QObject::tr ("Goto Bookmark"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_bookmark_view", "bookmark_view", at, tl::to_string (QObject::tr ("Bookmark This View"))));
|
||||
|
||||
menu_entries.push_back (lay::separator ("bookmark_mgm_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_manage_bookmarks", "manage_bookmarks", at, tl::to_string (QObject::tr ("Manage Bookmarks"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_load_bookmarks", "load_bookmarks", at, tl::to_string (QObject::tr ("Load Bookmarks"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_save_bookmarks", "save_bookmarks", at, tl::to_string (QObject::tr ("Save Bookmarks"))));
|
||||
|
||||
at = "zoom_menu.end";
|
||||
menu_entries.push_back (lay::submenu ("global_trans", at, tl::to_string (QObject::tr ("Global Transformation"))));
|
||||
{
|
||||
std::string at = "zoom_menu.global_trans.end";
|
||||
menu_entries.push_back (lay::config_menu_item ("r0", at, tl::to_string (QObject::tr ("\\(r0\\)<:/r0.png>")), cfg_global_trans, "?r0 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("r90", at, tl::to_string (QObject::tr ("\\(r90\\)<:/r90.png>")), cfg_global_trans, "?r90 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("r180", at, tl::to_string (QObject::tr ("\\(r180\\)<:/r180.png>")), cfg_global_trans, "?r180 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("r270", at, tl::to_string (QObject::tr ("\\(r270\\)<:/r270.png>")), cfg_global_trans, "?r270 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("m0", at, tl::to_string (QObject::tr ("\\(m0\\)<:/m0.png>")), cfg_global_trans, "?m0 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("m45", at, tl::to_string (QObject::tr ("\\(m45\\)<:/m45.png>")), cfg_global_trans, "?m45 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("m90", at, tl::to_string (QObject::tr ("\\(m90\\)<:/m90.png>")), cfg_global_trans, "?m90 *1 0,0"));
|
||||
menu_entries.push_back (lay::config_menu_item ("m135", at, tl::to_string (QObject::tr ("\\(m135\\)<:/m135.png>")), cfg_global_trans, "?m135 *1 0,0"));
|
||||
}
|
||||
|
||||
menu_entries.push_back (lay::separator ("hier_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_max_hier", "max_hier", at, tl::to_string (QObject::tr ("Full Hierarchy(*)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_max_hier_0", "max_hier_0", at, tl::to_string (QObject::tr ("Box Only(0)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_max_hier_1", "max_hier_1", at, tl::to_string (QObject::tr ("Top Level Only(1)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_inc_max_hier", "inc_max_hier", at, tl::to_string (QObject::tr ("Increment Hierarchy(+)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_dec_max_hier", "dec_max_hier", at, tl::to_string (QObject::tr ("Decrement Hierarchy(-)"))));
|
||||
|
||||
menu_entries.push_back (lay::separator ("zoom_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_zoom_fit", "zoom_fit", at, tl::to_string (QObject::tr ("Zoom Fit(F2)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_zoom_fit_sel", "zoom_fit_sel", at, tl::to_string (QObject::tr ("Zoom Fit Selection(Shift+F2)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_zoom_in", "zoom_in", at, tl::to_string (QObject::tr ("Zoom In(Return)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_zoom_out", "zoom_out", at, tl::to_string (QObject::tr ("Zoom Out(Shift+Return)"))));
|
||||
/* disabled because that interferes with the use of the arrow keys for moving the selection
|
||||
MenuLayoutEntry::separator ("pan_group");
|
||||
menu_entries.push_back (lay::menu_item ("cm_pan_up", "pan_up", at, tl::to_string (QObject::tr ("Pan Up(Up)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_pan_down", "pan_down", at, tl::to_string (QObject::tr ("Pan Down(Down)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_pan_left", "pan_left", at, tl::to_string (QObject::tr ("Pan Left(Left)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_pan_right", "pan_right", at, tl::to_string (QObject::tr ("Pan Right(Right)"))));
|
||||
*/
|
||||
|
||||
menu_entries.push_back (lay::separator ("redraw_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_redraw", "redraw", at, tl::to_string (QObject::tr ("Redraw"))));
|
||||
menu_entries.push_back (lay::separator ("state_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_prev_display_state", "prev_display_state", at, tl::to_string (QObject::tr ("Back(Shift+Tab)<:/back.png>"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_next_display_state", "next_display_state", at, tl::to_string (QObject::tr ("Forward(Tab)<:/forward.png>"))));
|
||||
|
||||
menu_entries.push_back (lay::separator ("select_group", at));
|
||||
menu_entries.push_back (lay::menu_item ("cm_select_cell", "select_cell:edit", at, tl::to_string (QObject::tr ("Select Cell"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_select_current_cell", "select_current_cell", at, tl::to_string (QObject::tr ("Show As New Top(Ctrl+S)"))));
|
||||
menu_entries.push_back (lay::menu_item ("cm_goto_position", "goto_position", at, tl::to_string (QObject::tr ("Goto Position(Ctrl+G)"))));
|
||||
|
||||
// Add a hook for inserting new items after the modes
|
||||
menu_entries.push_back (lay::separator ("end_modes", "@toolbar.end"));
|
||||
|
||||
}
|
||||
|
||||
void implements_primary_mouse_modes (std::vector<std::pair<std::string, std::pair<std::string, int> > > &modes)
|
||||
{
|
||||
std::vector <std::string> mode_titles;
|
||||
lay::LayoutView::intrinsic_mouse_modes (&mode_titles);
|
||||
|
||||
int mode_id = 0;
|
||||
for (std::vector <std::string>::const_iterator t = mode_titles.begin (); t != mode_titles.end (); ++t, --mode_id) {
|
||||
// modes: pair(title, pair(insert_pos, id))
|
||||
modes.push_back (std::make_pair (*t, std::make_pair ("edit_menu.mode_menu.end;@toolbar.end_modes", mode_id)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new LayoutViewPluginDeclaration (), -10, "LayoutViewPlugin");
|
||||
|
||||
} // namespace lay
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
|
||||
#include "layLayerProperties.h"
|
||||
#include "layAbstractMenu.h"
|
||||
#include "layAbstractMenuProvider.h"
|
||||
#include "layAnnotationShapes.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "layLayoutCanvas.h"
|
||||
#include "layColorPalette.h"
|
||||
#include "layStipplePalette.h"
|
||||
|
|
@ -81,7 +81,6 @@ class SelectionService;
|
|||
class MoveService;
|
||||
class Browser;
|
||||
class ColorButton;
|
||||
class PluginRoot;
|
||||
class ConfigureAction;
|
||||
|
||||
/**
|
||||
|
|
@ -159,8 +158,7 @@ struct LAYBASIC_PUBLIC LayerDisplayProperties
|
|||
class LAYBASIC_PUBLIC LayoutView
|
||||
: public QFrame,
|
||||
public lay::Editables,
|
||||
public lay::Plugin,
|
||||
public lay::AbstractMenuProvider
|
||||
public lay::Dispatcher
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -198,7 +196,7 @@ public:
|
|||
/**
|
||||
* @brief Constructor (clone from another view)
|
||||
*/
|
||||
LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::PluginRoot *root, QWidget *parent = 0, const char *name = "view", unsigned int options = (unsigned int) LV_Normal);
|
||||
LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, QWidget *parent = 0, const char *name = "view", unsigned int options = (unsigned int) LV_Normal);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
|
|
@ -1667,11 +1665,6 @@ public:
|
|||
*/
|
||||
static unsigned int intrinsic_mouse_modes (std::vector<std::string> *descriptions);
|
||||
|
||||
/**
|
||||
* @brief Perform the layout view's initialisations on the main menu
|
||||
*/
|
||||
static void init_menu (lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief Updates the menu for the given view
|
||||
* If the view is 0, the menu shall be updated to reflect "no view active"
|
||||
|
|
@ -2018,7 +2011,7 @@ public:
|
|||
* PD is the type of the declaration.
|
||||
*/
|
||||
template <class PD>
|
||||
void create_plugin (lay::PluginRoot *root)
|
||||
void create_plugin ()
|
||||
{
|
||||
for (std::vector<lay::Plugin *>::const_iterator p = mp_plugins.begin (); p != mp_plugins.end (); ++p) {
|
||||
if (dynamic_cast <const PD *> ((*p)->plugin_declaration ()) != 0) {
|
||||
|
|
@ -2027,7 +2020,7 @@ public:
|
|||
}
|
||||
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
|
||||
if (dynamic_cast <const PD *> (&*cls) != 0) {
|
||||
create_plugin (root, &*cls);
|
||||
create_plugin (&*cls);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2516,7 +2509,7 @@ public:
|
|||
*
|
||||
* If plugins already exist, they are deleted and created again
|
||||
*/
|
||||
void create_plugins (lay::PluginRoot *root, const lay::PluginDeclaration *except_this = 0);
|
||||
void create_plugins (const lay::PluginDeclaration *except_this = 0);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
|
|
@ -2678,6 +2671,7 @@ public slots:
|
|||
void layer_order_changed ();
|
||||
void timer ();
|
||||
void menu_activated (const std::string &symbol);
|
||||
static std::vector<std::string> menu_symbols ();
|
||||
void deactivate_all_browsers ();
|
||||
void min_hier_changed (int i);
|
||||
void max_hier_changed (int i);
|
||||
|
|
@ -2762,12 +2756,6 @@ protected:
|
|||
void activate ();
|
||||
|
||||
private:
|
||||
lay::AbstractMenu m_menu;
|
||||
std::auto_ptr<lay::PluginRoot> mp_plugin_root;
|
||||
std::map<std::string, lay::Action> m_actions_for_slot;
|
||||
std::map<std::string, std::vector<lay::ConfigureAction *> > m_configuration_actions;
|
||||
tl::shared_collection<lay::ConfigureAction> m_ca_collection;
|
||||
|
||||
bool m_editable;
|
||||
int m_disabled_edits;
|
||||
unsigned int m_options;
|
||||
|
|
@ -2904,7 +2892,7 @@ private:
|
|||
bool m_active_cellview_changed_event_enabled;
|
||||
tl::DeferredMethod<lay::LayoutView> dm_prop_changed;
|
||||
|
||||
void init (db::Manager *mgr, lay::PluginRoot *root, QWidget *parent);
|
||||
void init (db::Manager *mgr, lay::Dispatcher *dispatcher, QWidget *parent);
|
||||
|
||||
void do_prop_changed ();
|
||||
void do_redraw (int layer);
|
||||
|
|
@ -2937,6 +2925,11 @@ private:
|
|||
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
|
||||
void merge_dither_pattern (lay::LayerPropertiesList &props);
|
||||
|
||||
void do_cm_duplicate (bool interactive);
|
||||
void do_cm_paste (bool interactive);
|
||||
void cm_new_cell ();
|
||||
void cm_reload ();
|
||||
|
||||
// overrides Editables method to display a message
|
||||
void signal_selection_changed ();
|
||||
|
||||
|
|
@ -2944,18 +2937,13 @@ private:
|
|||
void showEvent (QShowEvent *);
|
||||
void hideEvent (QHideEvent *);
|
||||
|
||||
lay::Plugin *create_plugin (lay::PluginRoot *root, const lay::PluginDeclaration *cls);
|
||||
lay::Plugin *create_plugin (const lay::PluginDeclaration *cls);
|
||||
|
||||
std::list<lay::CellView>::iterator cellview_iter (int cv_index);
|
||||
std::list<lay::CellView>::const_iterator cellview_iter (int cv_index) const;
|
||||
|
||||
// implementation of AbstractMenuProvider
|
||||
// implementation of Dispatcher
|
||||
virtual QWidget *menu_parent_widget ();
|
||||
virtual lay::Action &action_for_slot (const char *slot);
|
||||
virtual lay::Action *create_config_action (const std::string &title, const std::string &cname, const std::string &cvalue);
|
||||
virtual lay::Action *create_config_action (const std::string &cname, const std::string &cvalue);
|
||||
virtual void register_config_action (const std::string &name, lay::ConfigureAction *action);
|
||||
virtual void unregister_config_action (const std::string &name, lay::ConfigureAction *action);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ public:
|
|||
LayoutViewConfigPage (QWidget *parent);
|
||||
~LayoutViewConfigPage ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage *mp_ui;
|
||||
|
|
@ -83,8 +83,8 @@ public:
|
|||
LayoutViewConfigPage1 (QWidget *parent);
|
||||
~LayoutViewConfigPage1 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage1 *mp_ui;
|
||||
|
|
@ -99,8 +99,8 @@ public:
|
|||
LayoutViewConfigPage2a (QWidget *parent);
|
||||
~LayoutViewConfigPage2a ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage2a *mp_ui;
|
||||
|
|
@ -115,8 +115,8 @@ public:
|
|||
LayoutViewConfigPage2b (QWidget *parent);
|
||||
~LayoutViewConfigPage2b ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage2b *mp_ui;
|
||||
|
|
@ -131,8 +131,8 @@ public:
|
|||
LayoutViewConfigPage2c (QWidget *parent);
|
||||
~LayoutViewConfigPage2c ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage2c *mp_ui;
|
||||
|
|
@ -147,8 +147,8 @@ public:
|
|||
LayoutViewConfigPage3a (QWidget *parent);
|
||||
~LayoutViewConfigPage3a ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage3a *mp_ui;
|
||||
|
|
@ -163,8 +163,8 @@ public:
|
|||
LayoutViewConfigPage3b (QWidget *parent);
|
||||
~LayoutViewConfigPage3b ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage3b *mp_ui;
|
||||
|
|
@ -179,8 +179,8 @@ public:
|
|||
LayoutViewConfigPage3c (QWidget *parent);
|
||||
~LayoutViewConfigPage3c ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage3c *mp_ui;
|
||||
|
|
@ -195,8 +195,8 @@ public:
|
|||
LayoutViewConfigPage3f (QWidget *parent);
|
||||
~LayoutViewConfigPage3f ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage3f *mp_ui;
|
||||
|
|
@ -212,8 +212,8 @@ public:
|
|||
LayoutViewConfigPage4 (QWidget *parent);
|
||||
~LayoutViewConfigPage4 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
virtual void undo (db::Op *op);
|
||||
virtual void redo (db::Op *op);
|
||||
|
|
@ -244,8 +244,8 @@ public:
|
|||
LayoutViewConfigPage5 (QWidget *parent);
|
||||
~LayoutViewConfigPage5 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
public slots:
|
||||
void browse_clicked ();
|
||||
|
|
@ -264,8 +264,8 @@ public:
|
|||
LayoutViewConfigPage6 (QWidget *parent);
|
||||
~LayoutViewConfigPage6 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
virtual void undo (db::Op *op);
|
||||
virtual void redo (db::Op *op);
|
||||
|
|
@ -298,8 +298,8 @@ public:
|
|||
LayoutViewConfigPage6a (QWidget *parent);
|
||||
~LayoutViewConfigPage6a ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
virtual void undo (db::Op *op);
|
||||
virtual void redo (db::Op *op);
|
||||
|
|
@ -329,8 +329,8 @@ public:
|
|||
LayoutViewConfigPage7 (QWidget *parent);
|
||||
~LayoutViewConfigPage7 ();
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
private:
|
||||
Ui::LayoutViewConfigPage7 *mp_ui;
|
||||
|
|
|
|||
|
|
@ -196,25 +196,6 @@ LibraryTreeWidget::mouseReleaseEvent (QMouseEvent *event)
|
|||
|
||||
const int max_cellviews_in_split_mode = 5;
|
||||
|
||||
void
|
||||
LibrariesView::init_menu (lay::AbstractMenu &menu)
|
||||
{
|
||||
MenuLayoutEntry context_menu [] = {
|
||||
#if 0
|
||||
// doesn't make sense for many libs
|
||||
MenuLayoutEntry ("split_mode", tl::to_string (QObject::tr ("Split Mode")), std::make_pair (cfg_split_lib_views, "?")),
|
||||
#endif
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
MenuLayoutEntry main_menu [] = {
|
||||
MenuLayoutEntry ("@lib_context_menu", "", context_menu),
|
||||
MenuLayoutEntry::last ()
|
||||
};
|
||||
|
||||
menu.init (main_menu);
|
||||
}
|
||||
|
||||
LibrariesView::LibrariesView (lay::LayoutView *view, QWidget *parent, const char *name)
|
||||
: QFrame (parent),
|
||||
m_enable_cb (true),
|
||||
|
|
@ -821,4 +802,28 @@ LibrariesView::has_focus () const
|
|||
return m_active_index >= 0 && m_active_index < int (mp_cell_lists.size ()) && mp_cell_lists [m_active_index]->hasFocus ();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Declaration of the "plugin" for the menu entries
|
||||
|
||||
class LibraryViewPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
std::string at;
|
||||
|
||||
at = ".end";
|
||||
menu_entries.push_back (lay::submenu ("@lib_context_menu", at, std::string ()));
|
||||
|
||||
at = "@lib_context_menu.end";
|
||||
#if 0
|
||||
// doesn't make sense for many libs
|
||||
menu_entries.push_back (lay::config_menu_item ("split_mode", at, tl::to_string (QObject::tr ("Split Mode")), cfg_split_lib_views, "?")),
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new LibraryViewPluginDeclaration (), -7, "LibraryViewPlugin");
|
||||
|
||||
} // namespace lay
|
||||
|
|
|
|||
|
|
@ -114,11 +114,6 @@ public:
|
|||
*/
|
||||
~LibrariesView ();
|
||||
|
||||
/**
|
||||
* @brief Perform the cell control panel's initialisations on the main menu
|
||||
*/
|
||||
static void init_menu (lay::AbstractMenu &menu);
|
||||
|
||||
/**
|
||||
* @brief The sizeHint implementation for Qt layout management
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace lay
|
|||
{
|
||||
|
||||
class LayoutView;
|
||||
class PluginRoot;
|
||||
class Dispatcher;
|
||||
class FileDialog;
|
||||
|
||||
class LAYBASIC_PUBLIC LoadLayoutOptionsDialog
|
||||
|
|
@ -64,7 +64,7 @@ public:
|
|||
LoadLayoutOptionsDialog (QWidget *parent, const std::string &title);
|
||||
~LoadLayoutOptionsDialog ();
|
||||
|
||||
bool edit_global_options (lay::PluginRoot *config_root, db::Technologies *technologies);
|
||||
bool edit_global_options (lay::Dispatcher *dispatcher, db::Technologies *technologies);
|
||||
bool get_options (db::LoadLayoutOptions &options);
|
||||
|
||||
void show_always (bool sa)
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ class NetlistBrowserConfigPage
|
|||
public:
|
||||
NetlistBrowserConfigPage (QWidget *parent);
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
public slots:
|
||||
void window_changed (int);
|
||||
|
|
@ -66,8 +66,8 @@ class NetlistBrowserConfigPage2
|
|||
public:
|
||||
NetlistBrowserConfigPage2 (QWidget *parent);
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
public slots:
|
||||
void color_button_clicked ();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "layAbstractMenuProvider.h"
|
||||
#include "laybasicCommon.h"
|
||||
|
||||
#include "tlException.h"
|
||||
|
|
@ -30,6 +29,7 @@
|
|||
#include "tlLog.h"
|
||||
|
||||
#include "layPlugin.h"
|
||||
#include "layDispatcher.h"
|
||||
#include "tlExceptions.h"
|
||||
#include "tlClassRegistry.h"
|
||||
|
||||
|
|
@ -56,8 +56,10 @@ PluginDeclaration::PluginDeclaration ()
|
|||
|
||||
PluginDeclaration::~PluginDeclaration ()
|
||||
{
|
||||
if (PluginRoot::instance ()) {
|
||||
PluginRoot::instance ()->plugin_removed (this);
|
||||
clear_menu_items ();
|
||||
|
||||
if (Dispatcher::instance ()) {
|
||||
Dispatcher::instance ()->plugin_removed (this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,6 +71,30 @@ PluginDeclaration::toggle_editable_enabled ()
|
|||
END_PROTECTED
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
PluginDeclaration::menu_symbols ()
|
||||
{
|
||||
std::vector<std::string> symbols;
|
||||
|
||||
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
|
||||
|
||||
std::vector<lay::MenuEntry> menu_entries;
|
||||
cls->get_menu_entries (menu_entries);
|
||||
|
||||
for (std::vector<lay::MenuEntry>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
||||
if (! m->symbol.empty ()) {
|
||||
symbols.push_back (m->symbol);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::sort (symbols.begin (), symbols.end ());
|
||||
symbols.erase (std::unique (symbols.begin (), symbols.end ()), symbols.end ());
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
void
|
||||
PluginDeclaration::generic_menu ()
|
||||
{
|
||||
|
|
@ -85,7 +111,7 @@ PluginDeclaration::generic_menu ()
|
|||
}
|
||||
|
||||
// Forward the request to the plugin root which will propagate it down to the plugins
|
||||
lay::PluginRoot::instance ()->menu_activated (symbol);
|
||||
lay::Dispatcher::instance ()->menu_activated (symbol);
|
||||
|
||||
END_PROTECTED
|
||||
}
|
||||
|
|
@ -100,8 +126,8 @@ PluginDeclaration::mode_triggered ()
|
|||
|
||||
int mode = action->data ().toInt ();
|
||||
|
||||
if (lay::PluginRoot::instance ()) {
|
||||
lay::PluginRoot::instance ()->select_mode (mode);
|
||||
if (lay::Dispatcher::instance ()) {
|
||||
lay::Dispatcher::instance ()->select_mode (mode);
|
||||
}
|
||||
|
||||
action->setChecked (true);
|
||||
|
|
@ -111,19 +137,24 @@ PluginDeclaration::mode_triggered ()
|
|||
END_PROTECTED
|
||||
}
|
||||
|
||||
void
|
||||
PluginDeclaration::init_menu ()
|
||||
void
|
||||
PluginDeclaration::clear_menu_items ()
|
||||
{
|
||||
if (! lay::AbstractMenuProvider::instance () || ! lay::AbstractMenuProvider::instance ()->menu ()) {
|
||||
return;
|
||||
while (! m_menu_actions.empty ()) {
|
||||
delete m_menu_actions.back ();
|
||||
m_menu_actions.pop_back ();
|
||||
}
|
||||
}
|
||||
|
||||
lay::AbstractMenu &menu = *lay::AbstractMenuProvider::instance ()->menu ();
|
||||
void
|
||||
PluginDeclaration::init_menu (lay::Dispatcher *dispatcher)
|
||||
{
|
||||
lay::AbstractMenu &menu = *dispatcher->menu ();
|
||||
|
||||
// pre-initialize to allow multiple init_menu calls
|
||||
m_editable_mode_action = lay::Action ();
|
||||
m_mouse_mode_action = lay::Action ();
|
||||
m_menu_actions.clear ();
|
||||
clear_menu_items ();
|
||||
|
||||
std::string title;
|
||||
|
||||
|
|
@ -158,19 +189,41 @@ PluginDeclaration::init_menu ()
|
|||
for (std::vector<lay::MenuEntry>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
||||
|
||||
if (m->title.empty ()) {
|
||||
|
||||
menu.insert_separator (m->insert_pos, m->menu_name);
|
||||
|
||||
} else {
|
||||
|
||||
if (m->sub_menu) {
|
||||
|
||||
menu.insert_menu (m->insert_pos, m->menu_name, m->title);
|
||||
|
||||
} else {
|
||||
|
||||
Action action (m->title);
|
||||
action.qaction ()->setData (QVariant (tl::to_qstring (m->symbol)));
|
||||
gtf::action_connect (action.qaction (), SIGNAL (triggered ()), this, SLOT (generic_menu ()));
|
||||
menu.insert_item (m->insert_pos, m->menu_name, action);
|
||||
Action *action = 0;
|
||||
|
||||
if (! m->cname.empty ()) {
|
||||
|
||||
action = dispatcher->create_config_action (m->title, m->cname, m->cvalue);
|
||||
|
||||
} else {
|
||||
|
||||
action = new Action (m->title);
|
||||
action->qaction ()->setData (QVariant (tl::to_qstring (m->symbol)));
|
||||
gtf::action_connect (action->qaction (), SIGNAL (triggered ()), this, SLOT (generic_menu ()));
|
||||
|
||||
}
|
||||
|
||||
m_menu_actions.push_back (action);
|
||||
menu.insert_item (m->insert_pos, m->menu_name, *action);
|
||||
|
||||
if (! m->exclusive_group.empty ()) {
|
||||
action->add_to_exclusive_group (&menu, m->exclusive_group);
|
||||
}
|
||||
|
||||
if (m->checkable) {
|
||||
action->set_checkable (true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -178,13 +231,29 @@ PluginDeclaration::init_menu ()
|
|||
|
||||
}
|
||||
|
||||
// Fill the mode menu file items from the mouse modes
|
||||
// Fill the mode menu file items from the mouse modes
|
||||
|
||||
std::vector<std::pair<std::string, std::pair<std::string, int> > > modes;
|
||||
|
||||
title = std::string ();
|
||||
if (implements_mouse_mode (title)) {
|
||||
modes.push_back (std::make_pair (title, std::make_pair ("edit_menu.mode_menu.end;@toolbar.end", id ())));
|
||||
}
|
||||
|
||||
// the primary mouse modes (special for LayoutView)
|
||||
implements_primary_mouse_modes (modes);
|
||||
|
||||
for (std::vector<std::pair<std::string, int> >::const_iterator m = modes.begin (); m != modes.end (); ++m) {
|
||||
|
||||
// extract first part, which is the name, separated by a tab from the title.
|
||||
std::string name = tl::sprintf ("mode_%d", id ());
|
||||
std::string name;
|
||||
if (m->second.second <= 0) {
|
||||
name = tl::sprintf ("mode_i%d", 1 - m->second.second);
|
||||
} else {
|
||||
name = tl::sprintf ("mode_%d", m->second.second);
|
||||
}
|
||||
std::string title = m->first;
|
||||
|
||||
const char *tab = strchr (title.c_str (), '\t');
|
||||
if (tab) {
|
||||
name = std::string (title, 0, tab - title.c_str ());
|
||||
|
|
@ -193,12 +262,10 @@ PluginDeclaration::init_menu ()
|
|||
|
||||
m_mouse_mode_action = Action (title);
|
||||
m_mouse_mode_action.add_to_exclusive_group (&menu, "mouse_mode_exclusive_group");
|
||||
|
||||
m_mouse_mode_action.set_checkable (true);
|
||||
m_mouse_mode_action.qaction ()->setData (QVariant (id ()));
|
||||
m_mouse_mode_action.qaction ()->setData (QVariant (m->second.second));
|
||||
|
||||
menu.insert_item ("edit_menu.mode_menu.end", name, m_mouse_mode_action);
|
||||
menu.insert_item ("@toolbar.end_modes", name, m_mouse_mode_action);
|
||||
menu.insert_item (m->second.first, name + ":mode_group", m_mouse_mode_action);
|
||||
|
||||
gtf::action_connect (m_mouse_mode_action.qaction (), SIGNAL (triggered ()), this, SLOT (mode_triggered ()));
|
||||
|
||||
|
|
@ -208,15 +275,15 @@ PluginDeclaration::init_menu ()
|
|||
void
|
||||
PluginDeclaration::remove_menu_items ()
|
||||
{
|
||||
if (! lay::AbstractMenuProvider::instance () || ! lay::AbstractMenuProvider::instance ()->menu ()) {
|
||||
if (! lay::Dispatcher::instance () || ! lay::Dispatcher::instance ()->menu ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
lay::AbstractMenu *menu = lay::AbstractMenuProvider::instance ()->menu ();
|
||||
lay::AbstractMenu *menu = lay::Dispatcher::instance ()->menu ();
|
||||
menu->delete_items (m_editable_mode_action);
|
||||
menu->delete_items (m_mouse_mode_action);
|
||||
for (std::vector <lay::Action>::const_iterator a = m_menu_actions.begin (); a != m_menu_actions.end (); ++a) {
|
||||
menu->delete_items (*a);
|
||||
for (std::vector <lay::Action *>::const_iterator a = m_menu_actions.begin (); a != m_menu_actions.end (); ++a) {
|
||||
menu->delete_items (**a);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,9 +300,9 @@ PluginDeclaration::set_editable_enabled (bool f)
|
|||
void
|
||||
PluginDeclaration::register_plugin ()
|
||||
{
|
||||
if (PluginRoot::instance ()) {
|
||||
PluginRoot::instance ()->plugin_registered (this);
|
||||
initialize (PluginRoot::instance ());
|
||||
if (Dispatcher::instance ()) {
|
||||
Dispatcher::instance ()->plugin_registered (this);
|
||||
initialize (Dispatcher::instance ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,26 +432,26 @@ Plugin::get_config_names (std::vector<std::string> &names) const
|
|||
}
|
||||
}
|
||||
|
||||
PluginRoot *
|
||||
Plugin::plugin_root ()
|
||||
Dispatcher *
|
||||
Plugin::dispatcher ()
|
||||
{
|
||||
Plugin *p = this;
|
||||
while (p->mp_parent) {
|
||||
p = p->mp_parent;
|
||||
}
|
||||
|
||||
return dynamic_cast<PluginRoot *> (p);
|
||||
return dynamic_cast<Dispatcher *> (p);
|
||||
}
|
||||
|
||||
PluginRoot *
|
||||
Plugin::plugin_root_maybe_null ()
|
||||
Dispatcher *
|
||||
Plugin::dispatcher_maybe_null ()
|
||||
{
|
||||
Plugin *p = this;
|
||||
while (p->mp_parent) {
|
||||
p = p->mp_parent;
|
||||
}
|
||||
|
||||
return dynamic_cast<PluginRoot *> (p);
|
||||
return dynamic_cast<Dispatcher *> (p);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -434,190 +501,4 @@ Plugin::do_config_set (const std::string &name, const std::string &value, bool f
|
|||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// PluginRoot implementation
|
||||
|
||||
static PluginRoot *ms_root_instance = 0;
|
||||
|
||||
PluginRoot::PluginRoot (bool standalone, bool reg_inst)
|
||||
: Plugin (0, standalone)
|
||||
{
|
||||
if (reg_inst) {
|
||||
ms_root_instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
PluginRoot::~PluginRoot ()
|
||||
{
|
||||
if (ms_root_instance == this) {
|
||||
ms_root_instance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Writing and Reading of configuration
|
||||
|
||||
struct ConfigGetAdaptor
|
||||
{
|
||||
ConfigGetAdaptor (const std::string &name)
|
||||
: mp_owner (0), m_done (false), m_name (name)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
std::string operator () () const
|
||||
{
|
||||
std::string s;
|
||||
mp_owner->config_get (m_name, s);
|
||||
return s;
|
||||
}
|
||||
|
||||
bool at_end () const
|
||||
{
|
||||
return m_done;
|
||||
}
|
||||
|
||||
void start (const lay::PluginRoot &owner)
|
||||
{
|
||||
mp_owner = &owner;
|
||||
m_done = false;
|
||||
}
|
||||
|
||||
void next ()
|
||||
{
|
||||
m_done = true;
|
||||
}
|
||||
|
||||
private:
|
||||
const lay::PluginRoot *mp_owner;
|
||||
bool m_done;
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
struct ConfigGetNullAdaptor
|
||||
{
|
||||
ConfigGetNullAdaptor ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
std::string operator () () const
|
||||
{
|
||||
return std::string ();
|
||||
}
|
||||
|
||||
bool at_end () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void start (const lay::PluginRoot & /*owner*/) { }
|
||||
void next () { }
|
||||
};
|
||||
|
||||
struct ConfigNamedSetAdaptor
|
||||
{
|
||||
ConfigNamedSetAdaptor ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void operator () (lay::PluginRoot &w, tl::XMLReaderState &reader, const std::string &name) const
|
||||
{
|
||||
tl::XMLObjTag<std::string> tag;
|
||||
w.config_set (name, *reader.back (tag));
|
||||
}
|
||||
};
|
||||
|
||||
struct ConfigSetAdaptor
|
||||
{
|
||||
ConfigSetAdaptor (const std::string &name)
|
||||
: m_name (name)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
void operator () (lay::PluginRoot &w, tl::XMLReaderState &reader) const
|
||||
{
|
||||
tl::XMLObjTag<std::string> tag;
|
||||
w.config_set (m_name, *reader.back (tag));
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
};
|
||||
|
||||
// the configuration file's XML structure is built dynamically
|
||||
static tl::XMLStruct<lay::PluginRoot>
|
||||
config_structure (const lay::PluginRoot *plugin)
|
||||
{
|
||||
tl::XMLElementList body;
|
||||
std::string n_with_underscores;
|
||||
|
||||
std::vector <std::string> names;
|
||||
plugin->get_config_names (names);
|
||||
|
||||
for (std::vector <std::string>::const_iterator n = names.begin (); n != names.end (); ++n) {
|
||||
|
||||
body.append (tl::XMLMember<std::string, lay::PluginRoot, ConfigGetAdaptor, ConfigSetAdaptor, tl::XMLStdConverter <std::string> > (
|
||||
ConfigGetAdaptor (*n), ConfigSetAdaptor (*n), *n));
|
||||
|
||||
// for compatibility, provide an alternative with underscores (i.e. 0.20->0.21 because of default_grids)
|
||||
n_with_underscores.clear ();
|
||||
for (const char *c = n->c_str (); *c; ++c) {
|
||||
n_with_underscores += (*c == '-' ? '_' : *c);
|
||||
}
|
||||
|
||||
body.append (tl::XMLMember<std::string, lay::PluginRoot, ConfigGetNullAdaptor, ConfigSetAdaptor, tl::XMLStdConverter <std::string> > (
|
||||
ConfigGetNullAdaptor (), ConfigSetAdaptor (*n), n_with_underscores));
|
||||
|
||||
}
|
||||
|
||||
// add a wildcard member to read all others unspecifically into the repository
|
||||
body.append (tl::XMLWildcardMember<std::string, lay::PluginRoot, ConfigNamedSetAdaptor, tl::XMLStdConverter <std::string> > (ConfigNamedSetAdaptor ()));
|
||||
|
||||
return tl::XMLStruct<lay::PluginRoot> ("config", body);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PluginRoot::write_config (const std::string &config_file)
|
||||
{
|
||||
try {
|
||||
tl::OutputStream os (config_file, tl::OutputStream::OM_Plain);
|
||||
config_structure (this).write (os, *this);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PluginRoot::read_config (const std::string &config_file)
|
||||
{
|
||||
std::auto_ptr<tl::XMLFileSource> file;
|
||||
|
||||
try {
|
||||
file.reset (new tl::XMLFileSource (config_file));
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
config_structure (this).parse (*file, *this);
|
||||
} catch (tl::Exception &ex) {
|
||||
std::string msg = tl::to_string (QObject::tr ("Problem reading config file ")) + config_file + ": " + ex.msg ();
|
||||
throw tl::Exception (msg);
|
||||
}
|
||||
|
||||
config_end ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PluginRoot *
|
||||
PluginRoot::instance ()
|
||||
{
|
||||
return ms_root_instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace lay
|
|||
{
|
||||
|
||||
class Plugin;
|
||||
class PluginRoot;
|
||||
class Dispatcher;
|
||||
class LayoutView;
|
||||
class Browser;
|
||||
class ViewService;
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
* The implementation is supposed to fetch the configuration from the
|
||||
* Plugin object provided and load the widgets accordingly.
|
||||
*/
|
||||
virtual void setup (PluginRoot * /*root*/)
|
||||
virtual void setup (Dispatcher * /*root*/)
|
||||
{
|
||||
// the default implementation does nothing.
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ public:
|
|||
* throw exceptions if the configuration something is invalid)
|
||||
* and commit the changes through
|
||||
*/
|
||||
virtual void commit (PluginRoot * /*root*/)
|
||||
virtual void commit (Dispatcher * /*root*/)
|
||||
{
|
||||
// the default implementation does nothing.
|
||||
}
|
||||
|
|
@ -98,42 +98,111 @@ public:
|
|||
|
||||
/**
|
||||
* @brief A menu entry declaration
|
||||
* See separator, menu_item, submenu and config_menu_item below.
|
||||
*/
|
||||
struct LAYBASIC_PUBLIC MenuEntry
|
||||
{
|
||||
/**
|
||||
* @brief A declaration for a separator
|
||||
*
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
*/
|
||||
MenuEntry (const std::string &menu_name_, const std::string &insert_pos_)
|
||||
: menu_name (menu_name_), insert_pos (insert_pos_), sub_menu (false)
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A declaration for a menu entry
|
||||
*
|
||||
* @param symbol The symbol to send when this menu item is selected
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
* @param title The title to display plus optional icon resource and keyboard shortcut. The format of the string is: <text>["("shortcut")"]["<"icon-resource">"][{"tool-tip"}].
|
||||
*/
|
||||
MenuEntry (const std::string &symbol_, const std::string &menu_name_, const std::string &insert_pos_, const std::string &title_, bool sub_menu_ = false)
|
||||
: menu_name (menu_name_), symbol (symbol_), insert_pos (insert_pos_), title (title_), sub_menu (sub_menu_)
|
||||
{
|
||||
// ..
|
||||
}
|
||||
MenuEntry () : sub_menu (false), checkable (false) { }
|
||||
|
||||
std::string menu_name;
|
||||
std::string symbol;
|
||||
std::string insert_pos;
|
||||
std::string title;
|
||||
std::string cname;
|
||||
std::string cvalue;
|
||||
std::string exclusive_group;
|
||||
bool sub_menu;
|
||||
bool checkable;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates a separator menu entry
|
||||
*
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
*/
|
||||
MenuEntry separator (const std::string &menu_name, const std::string &insert_pos)
|
||||
{
|
||||
MenuEntry e;
|
||||
e.menu_name = menu_name;
|
||||
e.insert_pos = insert_pos;
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a normal menu entry
|
||||
*
|
||||
* @param symbol The symbol to send when this menu item is selected
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
* @param title The title to display plus optional icon resource and keyboard shortcut. The format of the string is: <text>["("shortcut")"]["<"icon-resource">"][{"tool-tip"}].
|
||||
*/
|
||||
MenuEntry menu_item (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||
{
|
||||
MenuEntry e;
|
||||
e.symbol = symbol;
|
||||
e.menu_name = menu_name;
|
||||
e.insert_pos = insert_pos;
|
||||
e.title = title;
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a submenu entry
|
||||
*
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
* @param title The title to display plus optional icon resource and keyboard shortcut. The format of the string is: <text>["("shortcut")"]["<"icon-resource">"][{"tool-tip"}].
|
||||
*/
|
||||
MenuEntry submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||
{
|
||||
MenuEntry e;
|
||||
e.menu_name = menu_name;
|
||||
e.insert_pos = insert_pos;
|
||||
e.title = title;
|
||||
e.sub_menu = true;
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a submenu entry
|
||||
*
|
||||
* @param symbol The symbol to send when this menu item is selected
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
* @param title The title to display plus optional icon resource and keyboard shortcut. The format of the string is: <text>["("shortcut")"]["<"icon-resource">"][{"tool-tip"}].
|
||||
*/
|
||||
MenuEntry submenu (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||
{
|
||||
MenuEntry e;
|
||||
e.symbol = symbol;
|
||||
e.menu_name = menu_name;
|
||||
e.insert_pos = insert_pos;
|
||||
e.title = title;
|
||||
e.sub_menu = true;
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a configuration entry
|
||||
*
|
||||
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||
* @param title The title to display plus optional icon resource and keyboard shortcut. The format of the string is: <text>["("shortcut")"]["<"icon-resource">"][{"tool-tip"}].
|
||||
* @param cname The name of the configuration item
|
||||
* @param cvalue The value to set for the configuration item (optional for boolean configuration items)
|
||||
*/
|
||||
MenuEntry config_menu_item (const std::string &menu_name, const std::string &insert_pos, const std::string &title, const std::string &cname, const std::string &cvalue = std::string ())
|
||||
{
|
||||
MenuEntry e;
|
||||
e.menu_name = menu_name;
|
||||
e.insert_pos = insert_pos;
|
||||
e.title = title;
|
||||
e.cname = cname;
|
||||
e.cvalue = cvalue;
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The configuration declaration
|
||||
*
|
||||
|
|
@ -238,7 +307,7 @@ public:
|
|||
* Reimplementation of this method offers a chance to initialize static resources such as
|
||||
* dialogs etc.
|
||||
*/
|
||||
virtual void initialize (lay::PluginRoot * /*root*/)
|
||||
virtual void initialize (lay::Dispatcher * /*dispatcher*/)
|
||||
{
|
||||
// .. the default implementation does nothing ..
|
||||
}
|
||||
|
|
@ -251,7 +320,7 @@ public:
|
|||
* While initialize is called before any configuration is loaded, "initialized" will be
|
||||
* called after the pugin system has been initially configured.
|
||||
*/
|
||||
virtual void initialized (lay::PluginRoot * /*root*/)
|
||||
virtual void initialized (lay::Dispatcher * /*dispatcher*/)
|
||||
{
|
||||
// .. the default implementation does nothing ..
|
||||
}
|
||||
|
|
@ -259,7 +328,7 @@ public:
|
|||
/**
|
||||
* @brief Uninitialize the plugin
|
||||
*/
|
||||
virtual void uninitialize (lay::PluginRoot * /*root*/)
|
||||
virtual void uninitialize (lay::Dispatcher * /*dispatcher*/)
|
||||
{
|
||||
// .. the default implementation does nothing ..
|
||||
}
|
||||
|
|
@ -270,7 +339,7 @@ public:
|
|||
* If the plugin wants to prevent the application from closing, it may return false
|
||||
* in this method.
|
||||
*/
|
||||
virtual bool can_exit (lay::PluginRoot * /*root*/) const
|
||||
virtual bool can_exit (lay::Dispatcher * /*dispatcher*/) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -292,7 +361,7 @@ public:
|
|||
* This method may return 0 for "dummy" plugins that just register menu entries
|
||||
* or configuration options.
|
||||
*/
|
||||
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::PluginRoot * /*plugin_root*/, lay::LayoutView * /*view*/) const
|
||||
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::Dispatcher * /*dispatcher*/, lay::LayoutView * /*view*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -322,6 +391,17 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specifies the primary mouse modes
|
||||
*
|
||||
* These are built-in modes from the LayoutView. This method is intended for
|
||||
* the LayoutView's standard modes only.
|
||||
*/
|
||||
virtual void implements_primary_mouse_modes (std::vector<std::pair<std::string, std::pair<std::string, int> > > & /*modes*/)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the technology component provider
|
||||
|
|
@ -354,9 +434,17 @@ public:
|
|||
* @brief Creates the menu resources for this plugin
|
||||
*
|
||||
* This method will create the menu resources for the plugin and perform the
|
||||
* required connect operations.
|
||||
* required connect operations. The dispatcher provides the menu and the
|
||||
* event endpoints.
|
||||
*/
|
||||
void init_menu ();
|
||||
void init_menu (lay::Dispatcher *dispatcher);
|
||||
|
||||
/**
|
||||
* @brief Gets the available menu symbols from all plugins
|
||||
*
|
||||
* This does not mean all symbols will be available.
|
||||
*/
|
||||
static std::vector<std::string> menu_symbols ();
|
||||
|
||||
/**
|
||||
* @brief Removes the menu resources associated with this plugin
|
||||
|
|
@ -397,7 +485,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Notifies that plugin root that a new plugin was registered
|
||||
* @brief Notifies that dispatcher that a new plugin was registered
|
||||
*
|
||||
* This method must be called when a plugin is dynamically created. It is important
|
||||
* that when this method is called, the menu items and other properties are set already.
|
||||
|
|
@ -416,10 +504,12 @@ private slots:
|
|||
|
||||
private:
|
||||
int m_id;
|
||||
std::vector <lay::Action> m_menu_actions;
|
||||
std::vector <lay::Action *> m_menu_actions;
|
||||
lay::Action m_editable_mode_action;
|
||||
lay::Action m_mouse_mode_action;
|
||||
bool m_editable_enabled;
|
||||
|
||||
void clear_menu_items ();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -634,17 +724,17 @@ public:
|
|||
void get_config_names (std::vector<std::string> &names) const;
|
||||
|
||||
/**
|
||||
* @brief Gets the plugin root (the parent plugin not having another parent)
|
||||
* @brief Gets the dispatcher (the top level end of the plugin chain)
|
||||
* The returned pointer is guaranteed to be non-zero.
|
||||
*/
|
||||
PluginRoot *plugin_root ();
|
||||
Dispatcher *dispatcher ();
|
||||
|
||||
/**
|
||||
* @brief Gets the plugin root (the parent plugin not having another parent)
|
||||
* @brief Gets the dispatcher (the top level end of the plugin chain)
|
||||
* This version may return null, if the plugin is instantiated without a
|
||||
* root.
|
||||
*/
|
||||
PluginRoot *plugin_root_maybe_null ();
|
||||
Dispatcher *dispatcher_maybe_null ();
|
||||
|
||||
/**
|
||||
* @brief Menu command handler
|
||||
|
|
@ -790,78 +880,6 @@ private:
|
|||
bool m_standalone;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The plugin root element
|
||||
*
|
||||
* The first (root) object must be derived from this class.
|
||||
* This class offers the full "plugin" functionality like
|
||||
* configuration interface etc. but cannot have a parent.
|
||||
*/
|
||||
|
||||
class LAYBASIC_PUBLIC PluginRoot
|
||||
: public Plugin
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The constructor
|
||||
*/
|
||||
PluginRoot (bool standalone = false, bool reg_inst = true);
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~PluginRoot ();
|
||||
|
||||
/**
|
||||
* @brief Write configuration to a file
|
||||
*
|
||||
* If the configuration file cannot be written, false
|
||||
* is returned but no exception is thrown.
|
||||
*
|
||||
* @return false, if an error occurred.
|
||||
*/
|
||||
bool write_config (const std::string &config_file);
|
||||
|
||||
/**
|
||||
* @brief Read the configuration from a file
|
||||
*
|
||||
* This method siletly does nothing, if the config file does not
|
||||
* exist. If it does and an error occurred, the error message is printed
|
||||
* on stderr. In both cases, false is returned.
|
||||
*
|
||||
* @return false, if an error occurred.
|
||||
*/
|
||||
bool read_config (const std::string &config_file);
|
||||
|
||||
/**
|
||||
* @brief The singleton instance of the plugin root
|
||||
*/
|
||||
static PluginRoot *instance ();
|
||||
|
||||
/**
|
||||
* @brief Notifies the plugin root that a new plugin class has been registered
|
||||
*
|
||||
* This method is called when a plugin is loaded dynamically during runtime.
|
||||
*/
|
||||
virtual void plugin_registered (lay::PluginDeclaration * /*cls*/) { }
|
||||
|
||||
/**
|
||||
* @brief Notifies the plugin root that a plugin class is about to be removed
|
||||
*/
|
||||
virtual void plugin_removed (lay::PluginDeclaration * /*cls*/) { }
|
||||
|
||||
/**
|
||||
* @brief Selects the given mode
|
||||
*
|
||||
* The implementation is supposed to select the given mode on all related plugins.
|
||||
*/
|
||||
virtual void select_mode (int /*mode*/) { }
|
||||
|
||||
private:
|
||||
PluginRoot (const PluginRoot &);
|
||||
PluginRoot &operator= (const PluginRoot &);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A handy function for implementing the configure method
|
||||
*
|
||||
|
|
@ -885,11 +903,6 @@ inline bool test_and_set (T &target, const T &source)
|
|||
|
||||
namespace tl
|
||||
{
|
||||
// disable copy ctor for PluginRoot
|
||||
template <> struct type_traits<lay::PluginRoot> : public type_traits<void> {
|
||||
typedef tl::false_tag has_copy_constructor;
|
||||
};
|
||||
|
||||
// disable copy ctor for Plugin
|
||||
template <> struct type_traits<lay::Plugin> : public type_traits<void> {
|
||||
typedef tl::false_tag has_copy_constructor;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public:
|
|||
SaveLayoutOptionsDialog (QWidget *parent, const std::string &title);
|
||||
~SaveLayoutOptionsDialog ();
|
||||
|
||||
bool edit_global_options (lay::PluginRoot *config_root, db::Technologies *technologies);
|
||||
bool edit_global_options (lay::Dispatcher *dispatcher, db::Technologies *technologies);
|
||||
bool get_options (db::SaveLayoutOptions &options);
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ FORMS = \
|
|||
NetlistBrowserConfigPage2.ui \
|
||||
NetlistBrowserDialog.ui \
|
||||
NetInfoDialog.ui \
|
||||
NetExportDialog.ui
|
||||
NetExportDialog.ui \
|
||||
SelectCellViewForm.ui \
|
||||
LayoutStatistics.ui
|
||||
|
||||
RESOURCES = \
|
||||
laybasicResources.qrc
|
||||
|
|
@ -86,7 +88,6 @@ SOURCES = \
|
|||
gsiDeclLayPlugin.cc \
|
||||
gsiDeclLayStream.cc \
|
||||
layAbstractMenu.cc \
|
||||
layAbstractMenuProvider.cc \
|
||||
layAnnotationShapes.cc \
|
||||
layBitmap.cc \
|
||||
layBitmapRenderer.cc \
|
||||
|
|
@ -178,12 +179,14 @@ SOURCES = \
|
|||
layNetlistBrowserTreeModel.cc \
|
||||
layLibrariesView.cc \
|
||||
layBookmarksView.cc \
|
||||
layGenericSyntaxHighlighter.cc
|
||||
layGenericSyntaxHighlighter.cc \
|
||||
layDispatcher.cc \
|
||||
laySelectCellViewForm.cc \
|
||||
layLayoutStatisticsForm.cc
|
||||
|
||||
HEADERS = \
|
||||
gtf.h \
|
||||
layAbstractMenu.h \
|
||||
layAbstractMenuProvider.h \
|
||||
layAnnotationShapes.h \
|
||||
layBitmap.h \
|
||||
layBitmapRenderer.h \
|
||||
|
|
@ -277,7 +280,10 @@ HEADERS = \
|
|||
layNetlistBrowserTreeModel.h \
|
||||
layLibrariesView.h \
|
||||
layBookmarksView.h \
|
||||
layGenericSyntaxHighlighter.h
|
||||
layGenericSyntaxHighlighter.h \
|
||||
layDispatcher.h \
|
||||
laySelectCellViewForm.h \
|
||||
layLayoutStatisticsForm.h
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ class MarkerBrowserConfigPage
|
|||
public:
|
||||
MarkerBrowserConfigPage (QWidget *parent);
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
|
||||
public slots:
|
||||
void window_changed (int);
|
||||
|
|
@ -63,8 +63,8 @@ class MarkerBrowserConfigPage2
|
|||
public:
|
||||
MarkerBrowserConfigPage2 (QWidget *parent);
|
||||
|
||||
virtual void setup (lay::PluginRoot *root);
|
||||
virtual void commit (lay::PluginRoot *root);
|
||||
virtual void setup (lay::Dispatcher *root);
|
||||
virtual void commit (lay::Dispatcher *root);
|
||||
};
|
||||
|
||||
class MarkerBrowserContextModeConverter
|
||||
|
|
|
|||
Loading…
Reference in New Issue