From 91bf74350e06f18c8f0e94564d458f1b09da24a9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sun, 8 Jul 2012 23:24:42 -0300 Subject: [PATCH] Rename ui::Frame to ui::Window. --- src/CMakeLists.txt | 2 +- src/app.cpp | 8 +-- src/app.h | 5 +- src/app/widget_loader.cpp | 4 +- src/commands/cmd_about.cpp | 8 +-- src/commands/cmd_advanced_mode.cpp | 4 +- src/commands/cmd_canvas_size.cpp | 26 +++---- src/commands/cmd_cel_properties.cpp | 4 +- src/commands/cmd_configure_tools.cpp | 6 +- src/commands/cmd_developer_console.cpp | 8 +-- src/commands/cmd_duplicate_sprite.cpp | 4 +- src/commands/cmd_export_sprite_sheet.cpp | 18 ++--- src/commands/cmd_frame_properties.cpp | 8 +-- src/commands/cmd_goto_frame.cpp | 6 +- src/commands/cmd_grid.cpp | 10 +-- src/commands/cmd_import_sprite_sheet.cpp | 36 +++++----- src/commands/cmd_layer_properties.cpp | 8 +-- src/commands/cmd_new_file.cpp | 4 +- src/commands/cmd_new_layer.cpp | 4 +- src/commands/cmd_new_layer_set.cpp | 4 +- src/commands/cmd_options.cpp | 4 +- src/commands/cmd_palette_editor.cpp | 44 ++++++------ src/commands/cmd_sprite_properties.cpp | 4 +- src/commands/cmd_sprite_size.cpp | 4 +- .../filters/cmd_convolution_matrix.cpp | 6 +- src/commands/filters/cmd_despeckle.cpp | 6 +- src/commands/filters/cmd_invert_color.cpp | 2 +- src/commands/filters/color_curve_editor.cpp | 6 +- src/commands/filters/filter_window.cpp | 4 +- src/commands/filters/filter_window.h | 4 +- src/commands/filters/filter_worker.cpp | 2 +- src/console.cpp | 10 +-- src/dialogs/aniedit.cpp | 4 +- src/dialogs/maskcol.cpp | 10 +-- src/drop_files.cpp | 4 +- src/file/jpeg_format.cpp | 4 +- src/gfxmode.cpp | 2 +- src/job.cpp | 4 +- src/modules/editors.cpp | 66 +++++++++--------- src/modules/gui.cpp | 10 +-- src/modules/gui.h | 3 +- src/skin/skin_theme.cpp | 14 ++-- src/skin/skin_theme.h | 4 +- src/ui/CMakeLists.txt | 6 +- src/ui/alert.cpp | 6 +- src/ui/alert.h | 4 +- src/ui/base.h | 7 +- src/ui/button.cpp | 14 ++-- src/ui/combobox.cpp | 4 +- src/ui/combobox.h | 4 +- src/ui/gui.h | 4 +- src/ui/intern.cpp | 6 +- src/ui/intern.h | 2 +- src/ui/manager.cpp | 36 +++++----- src/ui/manager.h | 10 +-- src/ui/menu.cpp | 20 +++--- src/ui/message.h | 1 + src/ui/{popup_frame.cpp => popup_window.cpp} | 28 ++++---- src/ui/{popup_frame.h => popup_window.h} | 12 ++-- src/ui/theme.h | 3 +- src/ui/tooltips.cpp | 8 +-- src/ui/tooltips.h | 4 +- src/ui/widget.cpp | 12 ++-- src/ui/widget.h | 11 +-- src/ui/{frame.cpp => window.cpp} | 69 +++++++++---------- src/ui/{frame.h => window.h} | 15 ++-- src/widgets/color_button.cpp | 58 ++++++++-------- src/widgets/color_button.h | 4 +- src/widgets/color_selector.cpp | 2 +- src/widgets/color_selector.h | 4 +- src/widgets/file_selector.cpp | 4 +- src/widgets/file_selector.h | 4 +- ...pup_frame_pin.cpp => popup_window_pin.cpp} | 18 ++--- .../{popup_frame_pin.h => popup_window_pin.h} | 6 +- src/widgets/status_bar.cpp | 2 +- src/widgets/status_bar.h | 2 +- src/widgets/toolbar.cpp | 46 ++++++------- 77 files changed, 415 insertions(+), 419 deletions(-) rename src/ui/{popup_frame.cpp => popup_window.cpp} (88%) rename src/ui/{popup_frame.h => popup_window.h} (77%) rename src/ui/{frame.cpp => window.cpp} (92%) rename src/ui/{frame.h => window.h} (90%) rename src/widgets/{popup_frame_pin.cpp => popup_window_pin.cpp} (82%) rename src/widgets/{popup_frame_pin.h => popup_window_pin.h} (90%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b48cfd39..591b40137 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -382,7 +382,7 @@ add_library(aseprite-library widgets/hex_color_entry.cpp widgets/menuitem2.cpp widgets/palette_view.cpp - widgets/popup_frame_pin.cpp + widgets/popup_window_pin.cpp widgets/status_bar.cpp widgets/tabs.cpp widgets/toolbar.cpp) diff --git a/src/app.cpp b/src/app.cpp index aad6b09ec..52cb96798 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -100,7 +100,7 @@ public: App* App::m_instance = NULL; -static Frame* top_window = NULL; /* top level window (the desktop) */ +static Window* top_window = NULL; // Top level window (the desktop) static Widget* box_menubar = NULL; /* box where the menu bar is */ static Widget* box_colorbar = NULL; /* box where the color bar is */ static Widget* box_toolbar = NULL; /* box where the tools bar is */ @@ -185,7 +185,7 @@ int App::run() ui::Manager::getDefault()->invalidate(); // Load main window - top_window = app::load_widget("main_window.xml", "main_window"); + top_window = app::load_widget("main_window.xml", "main_window"); box_menubar = top_window->findChild("menubar"); box_editors = top_window->findChild("editor"); @@ -238,7 +238,7 @@ int App::run() set_current_editor(editor); // Open the window - top_window->open_window(); + top_window->openWindow(); // Redraw the whole screen. ui::Manager::getDefault()->invalidate(); @@ -482,7 +482,7 @@ PixelFormat app_get_current_pixel_format() return IMAGE_RGB; } -Frame* app_get_top_window() { return top_window; } +Window* app_get_top_window() { return top_window; } MenuBar* app_get_menubar() { return menubar; } StatusBar* app_get_statusbar() { return statusbar; } ColorBar* app_get_colorbar() { return colorbar; } diff --git a/src/app.h b/src/app.h index 30a8c60e2..79a1a411c 100644 --- a/src/app.h +++ b/src/app.h @@ -40,8 +40,9 @@ class StatusBar; class Tabs; namespace ui { - class Frame; class MenuBar; + class Widget; + class Window; } namespace tools { class ToolBox; } @@ -102,7 +103,7 @@ bool app_rebuild_recent_list(); PixelFormat app_get_current_pixel_format(); -ui::Frame* app_get_top_window(); +ui::Window* app_get_top_window(); ui::MenuBar* app_get_menubar(); StatusBar* app_get_statusbar(); ColorBar* app_get_colorbar(); diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp index 50e759c6a..56cc75551 100644 --- a/src/app/widget_loader.cpp +++ b/src/app/widget_loader.cpp @@ -370,9 +370,9 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget bool desktop = bool_attr_is_true(elem, "desktop"); if (desktop) - widget = new Frame(true, NULL); + widget = new Window(true, NULL); else - widget = new Frame(false, TRANSLATE_ATTR(text)); + widget = new Window(false, TRANSLATE_ATTR(text)); } } /* colorpicker */ diff --git a/src/commands/cmd_about.cpp b/src/commands/cmd_about.cpp index 9f86297a8..ab4d81f9b 100644 --- a/src/commands/cmd_about.cpp +++ b/src/commands/cmd_about.cpp @@ -50,7 +50,7 @@ AboutCommand::AboutCommand() void AboutCommand::onExecute(Context* context) { - UniquePtr frame(new Frame(false, "About " PACKAGE)); + UniquePtr window(new Window(false, "About " PACKAGE)); Box* box1 = new Box(JI_VERTICAL); Grid* grid = new Grid(2, false); Label* title = new Label(PACKAGE " v" VERSION); @@ -92,7 +92,7 @@ void AboutCommand::onExecute(Context* context) bottom_box1->addChild(bottom_box3); box1->addChild(grid); - frame->addChild(box1); + window->addChild(box1); jwidget_set_border(close_button, close_button->border_width.l + 16*jguiscale(), @@ -100,9 +100,9 @@ void AboutCommand::onExecute(Context* context) close_button->border_width.r + 16*jguiscale(), close_button->border_width.b); - close_button->Click.connect(Bind(&Frame::closeWindow, frame.get(), close_button)); + close_button->Click.connect(Bind(&Window::closeWindow, window.get(), close_button)); - frame->open_window_fg(); + window->openWindowInForeground(); } ////////////////////////////////////////////////////////////////////// diff --git a/src/commands/cmd_advanced_mode.cpp b/src/commands/cmd_advanced_mode.cpp index 860f63c2a..86b52bfe4 100644 --- a/src/commands/cmd_advanced_mode.cpp +++ b/src/commands/cmd_advanced_mode.cpp @@ -74,7 +74,7 @@ void AdvancedModeCommand::onExecute(Context* context) char key[1024]; char buf[1024]; - UniquePtr window(app::load_widget("advanced_mode.xml", "advanced_mode_warning")); + UniquePtr window(app::load_widget("advanced_mode.xml", "advanced_mode_warning")); Widget* warning_label = app::find_widget(window, "warning_label"); Widget* donot_show = app::find_widget(window, "donot_show"); @@ -84,7 +84,7 @@ void AdvancedModeCommand::onExecute(Context* context) warning_label->setText(buf); - window->open_window_fg(); + window->openWindowInForeground(); set_config_bool("AdvancedMode", "Warning", !donot_show->isSelected()); } diff --git a/src/commands/cmd_canvas_size.cpp b/src/commands/cmd_canvas_size.cpp index 5897ae45e..9632f6d08 100644 --- a/src/commands/cmd_canvas_size.cpp +++ b/src/commands/cmd_canvas_size.cpp @@ -43,13 +43,13 @@ using namespace ui; // Disable warning about usage of "this" in initializer list. #pragma warning(disable:4355) -// Frame used to show canvas parameters. -class CanvasSizeFrame : public Frame - , public SelectBoxDelegate +// Window used to show canvas parameters. +class CanvasSizeWindow : public Window + , public SelectBoxDelegate { public: - CanvasSizeFrame(int left, int top, int right, int bottom) - : Frame(false, "Canvas Size") + CanvasSizeWindow(int left, int top, int right, int bottom) + : Window(false, "Canvas Size") , m_editor(current_editor) , m_rect(-left, -top, current_editor->getSprite()->getWidth() + left + right, @@ -71,15 +71,15 @@ public: m_top->setTextf("%d", top); m_bottom->setTextf("%d", bottom); - m_left ->EntryChange.connect(Bind(&CanvasSizeFrame::onEntriesChange, this)); - m_right ->EntryChange.connect(Bind(&CanvasSizeFrame::onEntriesChange, this)); - m_top ->EntryChange.connect(Bind(&CanvasSizeFrame::onEntriesChange, this)); - m_bottom->EntryChange.connect(Bind(&CanvasSizeFrame::onEntriesChange, this)); + m_left ->EntryChange.connect(Bind(&CanvasSizeWindow::onEntriesChange, this)); + m_right ->EntryChange.connect(Bind(&CanvasSizeWindow::onEntriesChange, this)); + m_top ->EntryChange.connect(Bind(&CanvasSizeWindow::onEntriesChange, this)); + m_bottom->EntryChange.connect(Bind(&CanvasSizeWindow::onEntriesChange, this)); m_editor->setState(m_selectBoxState); } - ~CanvasSizeFrame() + ~CanvasSizeWindow() { m_editor->backToPreviousState(); } @@ -120,7 +120,7 @@ protected: virtual void onBroadcastMouseMessage(WidgetsList& targets) OVERRIDE { - Frame::onBroadcastMouseMessage(targets); + Window::onBroadcastMouseMessage(targets); // Add the editor as receptor of mouse events too. targets.push_back(View::getView(m_editor)); @@ -174,14 +174,14 @@ void CanvasSizeCommand::onExecute(Context* context) if (context->isUiAvailable()) { // load the window widget - UniquePtr window(new CanvasSizeFrame(0, 0, 0, 0)); + UniquePtr window(new CanvasSizeWindow(0, 0, 0, 0)); window->remap_window(); window->center_window(); load_window_pos(window, "CanvasSize"); window->setVisible(true); - window->open_window_fg(); + window->openWindowInForeground(); save_window_pos(window, "CanvasSize"); if (!window->pressedOk()) diff --git a/src/commands/cmd_cel_properties.cpp b/src/commands/cmd_cel_properties.cpp index bd6da95c0..329143878 100644 --- a/src/commands/cmd_cel_properties.cpp +++ b/src/commands/cmd_cel_properties.cpp @@ -71,7 +71,7 @@ void CelPropertiesCommand::onExecute(Context* context) // Get current cel (can be NULL) const Cel* cel = static_cast(layer)->getCel(sprite->getCurrentFrame()); - UniquePtr window(app::load_widget("cel_properties.xml", "cel_properties")); + UniquePtr window(app::load_widget("cel_properties.xml", "cel_properties")); Widget* label_frame = app::find_widget(window, "frame"); Widget* label_pos = app::find_widget(window, "pos"); Widget* label_size = app::find_widget(window, "size"); @@ -122,7 +122,7 @@ void CelPropertiesCommand::onExecute(Context* context) slider_opacity->setEnabled(false); } - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { DocumentWriter document_writer(document); diff --git a/src/commands/cmd_configure_tools.cpp b/src/commands/cmd_configure_tools.cpp index 5ef9f5032..9e640bfc2 100644 --- a/src/commands/cmd_configure_tools.cpp +++ b/src/commands/cmd_configure_tools.cpp @@ -53,7 +53,7 @@ using namespace gfx; using namespace ui; using namespace tools; -static Frame* window = NULL; +static Window* window = NULL; static bool window_close_hook(Widget* widget, void *data); @@ -270,7 +270,7 @@ void ConfigureTools::onExecute(Context* context) bool first_time = false; if (!window) { - window = app::load_widget("tools_configuration.xml", "configure_tool"); + window = app::load_widget("tools_configuration.xml", "configure_tool"); first_time = true; } /* if the window is opened, close it */ @@ -385,7 +385,7 @@ void ConfigureTools::onExecute(Context* context) // Load window configuration load_window_pos(window, "ConfigureTool"); - window->open_window_bg(); + window->openWindow(); } void ConfigureTools::onWindowClose() diff --git a/src/commands/cmd_developer_console.cpp b/src/commands/cmd_developer_console.cpp index 6b66c3e77..5c7e774f4 100644 --- a/src/commands/cmd_developer_console.cpp +++ b/src/commands/cmd_developer_console.cpp @@ -25,15 +25,15 @@ #include "ui/box.h" #include "ui/button.h" #include "ui/combobox.h" -#include "ui/frame.h" +#include "ui/window.h" using namespace ui; -class DeveloperConsole : public Frame +class DeveloperConsole : public Window { public: DeveloperConsole() - : Frame(false, "Developer Console") + : Window(false, "Developer Console") , m_vbox(JI_VERTICAL) { m_vbox.addChild(&m_docs); @@ -96,7 +96,7 @@ void DeveloperConsoleCommand::onExecute(Context* context) } m_devConsole->updateDocuments(context); - m_devConsole->open_window_bg(); + m_devConsole->openWindow(); } ////////////////////////////////////////////////////////////////////// diff --git a/src/commands/cmd_duplicate_sprite.cpp b/src/commands/cmd_duplicate_sprite.cpp index c66fcb200..43c643bb5 100644 --- a/src/commands/cmd_duplicate_sprite.cpp +++ b/src/commands/cmd_duplicate_sprite.cpp @@ -66,7 +66,7 @@ void DuplicateSpriteCommand::onExecute(Context* context) char buf[1024]; /* load the window widget */ - UniquePtr window(app::load_widget("duplicate_sprite.xml", "duplicate_sprite")); + UniquePtr window(app::load_widget("duplicate_sprite.xml", "duplicate_sprite")); src_name = window->findChild("src_name"); dst_name = window->findChild("dst_name"); @@ -81,7 +81,7 @@ void DuplicateSpriteCommand::onExecute(Context* context) flatten->setSelected(true); /* open the window */ - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == window->findChild("ok")) { set_config_bool("DuplicateSprite", "Flatten", flatten->isSelected()); diff --git a/src/commands/cmd_export_sprite_sheet.cpp b/src/commands/cmd_export_sprite_sheet.cpp index d7227cd5d..473fb9113 100644 --- a/src/commands/cmd_export_sprite_sheet.cpp +++ b/src/commands/cmd_export_sprite_sheet.cpp @@ -42,14 +42,14 @@ using namespace ui; ////////////////////////////////////////////////////////////////////// // ExportSpriteSheetFrame -class ExportSpriteSheetFrame : public Frame +class ExportSpriteSheetWindow : public Window { enum SpriteSheetType { HorizontalStrip, VerticalStrip, Matrix }; enum ExportAction { SaveCopyAs, SaveAs, Save, DoNotSave }; public: - ExportSpriteSheetFrame(Context* context) - : Frame(false, "Export Sprite Sheet") + ExportSpriteSheetWindow(Context* context) + : Window(false, "Export Sprite Sheet") , m_context(context) , m_document(context->getActiveDocument()) , m_grid(4, false) @@ -87,14 +87,14 @@ public: m_grid.addChildInCell(hbox1, 4, 1, 0); } - m_sheetType.Change.connect(&ExportSpriteSheetFrame::onSheetTypeChange, this); - m_export.Click.connect(Bind(&ExportSpriteSheetFrame::onExport, this)); - m_cancel.Click.connect(Bind(&ExportSpriteSheetFrame::onCancel, this)); + m_sheetType.Change.connect(&ExportSpriteSheetWindow::onSheetTypeChange, this); + m_export.Click.connect(Bind(&ExportSpriteSheetWindow::onExport, this)); + m_cancel.Click.connect(Bind(&ExportSpriteSheetWindow::onCancel, this)); onSheetTypeChange(); } - ~ExportSpriteSheetFrame() + ~ExportSpriteSheetWindow() { } @@ -316,8 +316,8 @@ bool ExportSpriteSheetCommand::onEnabled(Context* context) void ExportSpriteSheetCommand::onExecute(Context* context) { - UniquePtr frame(new ExportSpriteSheetFrame(context)); - frame->open_window_fg(); + UniquePtr window(new ExportSpriteSheetWindow(context)); + window->openWindowInForeground(); } ////////////////////////////////////////////////////////////////////// diff --git a/src/commands/cmd_frame_properties.cpp b/src/commands/cmd_frame_properties.cpp index 2aac299f7..06d8d0e13 100644 --- a/src/commands/cmd_frame_properties.cpp +++ b/src/commands/cmd_frame_properties.cpp @@ -89,7 +89,7 @@ void FramePropertiesCommand::onExecute(Context* context) const ActiveDocumentReader document(context); const Sprite* sprite = document->getSprite(); - UniquePtr window(app::load_widget("frame_duration.xml", "frame_duration")); + UniquePtr window(app::load_widget("frame_duration.xml", "frame_duration")); Widget* frame = app::find_widget(window, "frame"); Widget* frlen = app::find_widget(window, "frlen"); Widget* ok = app::find_widget(window, "ok"); @@ -110,13 +110,13 @@ void FramePropertiesCommand::onExecute(Context* context) } if (m_target == ALL_FRAMES) - frame->setText("All"); + window->setText("All"); else - frame->setTextf("%d", sprite_frame); + window->setTextf("%d", sprite_frame); frlen->setTextf("%d", sprite->getFrameDuration(sprite->getCurrentFrame())); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == ok) { int num = strtol(frlen->getText(), NULL, 10); diff --git a/src/commands/cmd_goto_frame.cpp b/src/commands/cmd_goto_frame.cpp index 30ed82303..6d2668d78 100644 --- a/src/commands/cmd_goto_frame.cpp +++ b/src/commands/cmd_goto_frame.cpp @@ -26,7 +26,7 @@ #include "modules/editors.h" #include "modules/gui.h" #include "raster/sprite.h" -#include "ui/frame.h" +#include "ui/window.h" #include "widgets/editor/editor.h" #include @@ -235,13 +235,13 @@ bool GotoFrameCommand::onEnabled(Context* context) void GotoFrameCommand::onExecute(Context* context) { if (m_frame == 0 && context->isUiAvailable()) { - UniquePtr window(app::load_widget("goto_frame.xml", "goto_frame")); + UniquePtr window(app::load_widget("goto_frame.xml", "goto_frame")); Widget* frame = app::find_widget(window, "frame"); Widget* ok = app::find_widget(window, "ok"); frame->setTextf("%d", context->getActiveDocument()->getSprite()->getCurrentFrame()+1); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() != ok) return; diff --git a/src/commands/cmd_grid.cpp b/src/commands/cmd_grid.cpp index 2bba456ef..9cc22dbe0 100644 --- a/src/commands/cmd_grid.cpp +++ b/src/commands/cmd_grid.cpp @@ -18,8 +18,6 @@ #include "config.h" -#include - #include "app.h" #include "app/find_widget.h" #include "app/load_widget.h" @@ -27,10 +25,12 @@ #include "context.h" #include "modules/editors.h" #include "settings/settings.h" -#include "ui/frame.h" +#include "ui/window.h" #include "ui_context.h" #include "widgets/status_bar.h" +#include + using namespace ui; using namespace gfx; @@ -132,7 +132,7 @@ bool GridSettingsCommand::onEnabled(Context* context) void GridSettingsCommand::onExecute(Context* context) { - UniquePtr window(app::load_widget("grid_settings.xml", "grid_settings")); + UniquePtr window(app::load_widget("grid_settings.xml", "grid_settings")); Widget* button_ok = app::find_widget(window, "ok"); Widget* grid_x = app::find_widget(window, "grid_x"); Widget* grid_y = app::find_widget(window, "grid_y"); @@ -146,7 +146,7 @@ void GridSettingsCommand::onExecute(Context* context) grid_w->setTextf("%d", bounds.w); grid_h->setTextf("%d", bounds.h); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { bounds.x = grid_x->getTextInt(); diff --git a/src/commands/cmd_import_sprite_sheet.cpp b/src/commands/cmd_import_sprite_sheet.cpp index 42b8be5ef..73c3230ac 100644 --- a/src/commands/cmd_import_sprite_sheet.cpp +++ b/src/commands/cmd_import_sprite_sheet.cpp @@ -46,14 +46,14 @@ using namespace ui; ////////////////////////////////////////////////////////////////////// -// ImportSpriteSheetFrame +// ImportSpriteSheetWindow -class ImportSpriteSheetFrame : public Frame, - public SelectBoxDelegate +class ImportSpriteSheetWindow : public Window, + public SelectBoxDelegate { public: - ImportSpriteSheetFrame(Context* context) - : Frame(false, "Import Sprite Sheet") + ImportSpriteSheetWindow(Context* context) + : Window(false, "Import Sprite Sheet") , m_context(context) , m_document(NULL) , m_grid(4, false) @@ -89,18 +89,18 @@ public: m_grid.addChildInCell(hbox1, 4, 1, 0); } - m_x.EntryChange.connect(Bind(&ImportSpriteSheetFrame::onEntriesChange, this)); - m_y.EntryChange.connect(Bind(&ImportSpriteSheetFrame::onEntriesChange, this)); - m_width.EntryChange.connect(Bind(&ImportSpriteSheetFrame::onEntriesChange, this)); - m_height.EntryChange.connect(Bind(&ImportSpriteSheetFrame::onEntriesChange, this)); + m_x.EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); + m_y.EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); + m_width.EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); + m_height.EntryChange.connect(Bind(&ImportSpriteSheetWindow::onEntriesChange, this)); - m_selectFile.Click.connect(&ImportSpriteSheetFrame::onSelectFile, this); - m_selectFile.DropDownClick.connect(&ImportSpriteSheetFrame::onDropDown, this); - m_import.Click.connect(Bind(&ImportSpriteSheetFrame::onImport, this)); - m_cancel.Click.connect(Bind(&ImportSpriteSheetFrame::onCancel, this)); + m_selectFile.Click.connect(&ImportSpriteSheetWindow::onSelectFile, this); + m_selectFile.DropDownClick.connect(&ImportSpriteSheetWindow::onDropDown, this); + m_import.Click.connect(Bind(&ImportSpriteSheetWindow::onImport, this)); + m_cancel.Click.connect(Bind(&ImportSpriteSheetWindow::onCancel, this)); } - ~ImportSpriteSheetFrame() + ~ImportSpriteSheetWindow() { releaseEditor(); } @@ -127,7 +127,7 @@ protected: { SharedPtr menu(new Menu()); MenuItem* item = new MenuItem("Use Current Sprite"); - item->Click.connect(&ImportSpriteSheetFrame::onUseCurrentSprite, this); + item->Click.connect(&ImportSpriteSheetWindow::onUseCurrentSprite, this); if (m_editor || current_editor->getDocument() == NULL) item->setEnabled(false); @@ -263,7 +263,7 @@ protected: virtual void onBroadcastMouseMessage(WidgetsList& targets) OVERRIDE { - Frame::onBroadcastMouseMessage(targets); + Window::onBroadcastMouseMessage(targets); // Add the editor as receptor of mouse events too. if (m_editor) @@ -359,8 +359,8 @@ ImportSpriteSheetCommand::ImportSpriteSheetCommand() void ImportSpriteSheetCommand::onExecute(Context* context) { - UniquePtr frame(new ImportSpriteSheetFrame(context)); - frame->open_window_fg(); + UniquePtr window(new ImportSpriteSheetWindow(context)); + window->openWindowInForeground(); } ////////////////////////////////////////////////////////////////////// diff --git a/src/commands/cmd_layer_properties.cpp b/src/commands/cmd_layer_properties.cpp index 7b99e422e..b5f3f809c 100644 --- a/src/commands/cmd_layer_properties.cpp +++ b/src/commands/cmd_layer_properties.cpp @@ -64,7 +64,7 @@ void LayerPropertiesCommand::onExecute(Context* context) const Sprite* sprite(document->getSprite()); const Layer* layer = sprite->getCurrentLayer(); - UniquePtr window(new Frame(false, "Layer Properties")); + UniquePtr window(new Window(false, "Layer Properties")); Box* box1 = new Box(JI_VERTICAL); Box* box2 = new Box(JI_HORIZONTAL); Box* box3 = new Box(JI_HORIZONTAL + JI_HOMOGENEOUS); @@ -73,8 +73,8 @@ void LayerPropertiesCommand::onExecute(Context* context) Button* button_ok = new Button("&OK"); Button* button_cancel = new Button("&Cancel"); - button_ok->Click.connect(Bind(&Frame::closeWindow, window.get(), button_ok)); - button_cancel->Click.connect(Bind(&Frame::closeWindow, window.get(), button_cancel)); + button_ok->Click.connect(Bind(&Window::closeWindow, window.get(), button_ok)); + button_cancel->Click.connect(Bind(&Window::closeWindow, window.get(), button_cancel)); jwidget_set_min_size(entry_name, 128, 0); entry_name->setExpansive(true); @@ -90,7 +90,7 @@ void LayerPropertiesCommand::onExecute(Context* context) entry_name->setFocusMagnet(true); button_ok->setFocusMagnet(true); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { DocumentWriter documentWriter(document); diff --git a/src/commands/cmd_new_file.cpp b/src/commands/cmd_new_file.cpp index 3ec0b877c..0d127fe37 100644 --- a/src/commands/cmd_new_file.cpp +++ b/src/commands/cmd_new_file.cpp @@ -83,7 +83,7 @@ void NewFileCommand::onExecute(Context* context) }; // Load the window widget - UniquePtr window(app::load_widget("new_sprite.xml", "new_sprite")); + UniquePtr window(app::load_widget("new_sprite.xml", "new_sprite")); Widget* width = app::find_widget(window, "width"); Widget* height = app::find_widget(window, "height"); Widget* radio1 = app::find_widget(window, "radio1"); @@ -127,7 +127,7 @@ void NewFileCommand::onExecute(Context* context) bg_box->selectIndex(bg); // Open the window - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == ok) { bool ok = false; diff --git a/src/commands/cmd_new_layer.cpp b/src/commands/cmd_new_layer.cpp index 2930511f7..cec8088d9 100644 --- a/src/commands/cmd_new_layer.cpp +++ b/src/commands/cmd_new_layer.cpp @@ -93,12 +93,12 @@ void NewLayerCommand::onExecute(Context* context) // If params specify to ask the user about the name... if (m_ask) { // We open the window to ask the name - UniquePtr window(app::load_widget("new_layer.xml", "new_layer")); + UniquePtr window(app::load_widget("new_layer.xml", "new_layer")); Widget* name_widget = app::find_widget(window, "name"); name_widget->setText(name.c_str()); jwidget_set_min_size(name_widget, 128, 0); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() != window->findChild("ok")) return; diff --git a/src/commands/cmd_new_layer_set.cpp b/src/commands/cmd_new_layer_set.cpp index a86d906fe..8611a08a7 100644 --- a/src/commands/cmd_new_layer_set.cpp +++ b/src/commands/cmd_new_layer_set.cpp @@ -63,9 +63,9 @@ void NewLayerSetCommand::onExecute(Context* context) Sprite* sprite(document->getSprite()); // load the window widget - UniquePtr window(app::load_widget("new_layer.xml", "new_layer_set")); + UniquePtr window(app::load_widget("new_layer.xml", "new_layer_set")); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == window->findChild("ok")) { const char *name = window->findChild("name")->getText(); diff --git a/src/commands/cmd_options.cpp b/src/commands/cmd_options.cpp index 02fb52c5d..2929619cf 100644 --- a/src/commands/cmd_options.cpp +++ b/src/commands/cmd_options.cpp @@ -67,7 +67,7 @@ OptionsCommand::OptionsCommand() void OptionsCommand::onExecute(Context* context) { /* load the window widget */ - UniquePtr window(app::load_widget("options.xml", "options")); + UniquePtr window(app::load_widget("options.xml", "options")); Widget* check_smooth = app::find_widget(window, "smooth"); Widget* move_click2 = app::find_widget(window, "move_click2"); Widget* draw_click2 = app::find_widget(window, "draw_click2"); @@ -132,7 +132,7 @@ void OptionsCommand::onExecute(Context* context) undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8)); // Show the window and wait the user to close it - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { int undo_size_limit_value; diff --git a/src/commands/cmd_palette_editor.cpp b/src/commands/cmd_palette_editor.cpp index 2b4fe6a34..c6ebce7a1 100644 --- a/src/commands/cmd_palette_editor.cpp +++ b/src/commands/cmd_palette_editor.cpp @@ -62,7 +62,7 @@ using namespace gfx; using namespace ui; -class PaletteEntryEditor : public Frame +class PaletteEntryEditor : public Window { public: PaletteEntryEditor(); @@ -74,7 +74,7 @@ protected: bool onProcessMessage(Message* msg) OVERRIDE; void onExit(); - void onCloseFrame(); + void onCloseWindow(); void onFgBgColorChange(const Color& color); void onColorSlidersChange(ColorSlidersChangeEvent& ev); void onColorHexEntryChange(const Color& color); @@ -141,7 +141,7 @@ private: ////////////////////////////////////////////////////////////////////// // PaletteEditorCommand -static PaletteEntryEditor* g_frame = NULL; +static PaletteEntryEditor* g_window = NULL; class PaletteEditorCommand : public Command { @@ -193,38 +193,38 @@ void PaletteEditorCommand::onLoadParams(Params* params) void PaletteEditorCommand::onExecute(Context* context) { // If this is the first time the command is execute... - if (!g_frame) { + if (!g_window) { // If the command says "Close the palette editor" and it is not // created yet, we just do nothing. if (m_close) return; // If this is "open" or "switch", we have to create the frame. - g_frame = new PaletteEntryEditor(); + g_window = new PaletteEntryEditor(); } // If the frame is already created and it's visible, close it (only in "switch" or "close" modes) - else if (g_frame->isVisible() && (m_switch || m_close)) { + else if (g_window->isVisible() && (m_switch || m_close)) { // Hide the frame - g_frame->closeWindow(NULL); + g_window->closeWindow(NULL); return; } if (m_switch || m_open) { - if (!g_frame->isVisible()) { + if (!g_window->isVisible()) { // Default bounds - g_frame->remap_window(); + g_window->remap_window(); - int width = MAX(jrect_w(g_frame->rc), JI_SCREEN_W/2); - g_frame->setBounds(Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc), - JI_SCREEN_H - jrect_h(g_frame->rc) - jrect_h(app_get_statusbar()->rc), - width, jrect_h(g_frame->rc))); + int width = MAX(jrect_w(g_window->rc), JI_SCREEN_W/2); + g_window->setBounds(Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc), + JI_SCREEN_H - jrect_h(g_window->rc) - jrect_h(app_get_statusbar()->rc), + width, jrect_h(g_window->rc))); // Load window configuration - load_window_pos(g_frame, "PaletteEditor"); + load_window_pos(g_window, "PaletteEditor"); } // Run the frame in background. - g_frame->open_window_bg(); + g_window->openWindow(); app_get_colorbar()->setPaletteEditorButtonState(true); } @@ -234,7 +234,7 @@ void PaletteEditorCommand::onExecute(Context* context) (m_background ? context->getSettings()->getBgColor(): context->getSettings()->getFgColor()); - g_frame->setColor(color); + g_window->setColor(color); } } @@ -244,7 +244,7 @@ void PaletteEditorCommand::onExecute(Context* context) // Based on ColorSelector class. PaletteEntryEditor::PaletteEntryEditor() - : Frame(false, "Palette Editor (F4)") + : Window(false, "Palette Editor (F4)") , m_vbox(JI_VERTICAL) , m_topBox(JI_HORIZONTAL) , m_bottomBox(JI_HORIZONTAL) @@ -334,10 +334,10 @@ PaletteEntryEditor::PaletteEntryEditor() app_get_colorbar()->FgColorChange.connect(&PaletteEntryEditor::onFgBgColorChange, this); app_get_colorbar()->BgColorChange.connect(&PaletteEntryEditor::onFgBgColorChange, this); - // We hook the Frame::Close event to save the frame position before closing it. - this->Close.connect(Bind(&PaletteEntryEditor::onCloseFrame, this)); + // We hook the Window::Close event to save the frame position before closing it. + this->Close.connect(Bind(&PaletteEntryEditor::onCloseWindow, this)); - // We hook App::Exit signal to destroy the g_frame singleton at exit. + // We hook App::Exit signal to destroy the g_window singleton at exit. App::instance()->Exit.connect(&PaletteEntryEditor::onExit, this); // Hook for palette change to redraw the palette editor frame @@ -425,7 +425,7 @@ bool PaletteEntryEditor::onProcessMessage(Message* msg) current_editor->updateEditor(); } } - return Frame::onProcessMessage(msg); + return Window::onProcessMessage(msg); } void PaletteEntryEditor::onExit() @@ -433,7 +433,7 @@ void PaletteEntryEditor::onExit() delete this; } -void PaletteEntryEditor::onCloseFrame() +void PaletteEntryEditor::onCloseWindow() { // Save window configuration save_window_pos(this, "PaletteEditor"); diff --git a/src/commands/cmd_sprite_properties.cpp b/src/commands/cmd_sprite_properties.cpp index b15cb87ef..9b688cfcc 100644 --- a/src/commands/cmd_sprite_properties.cpp +++ b/src/commands/cmd_sprite_properties.cpp @@ -71,7 +71,7 @@ void SpritePropertiesCommand::onExecute(Context* context) ColorButton* color_button = NULL; // Load the window widget - UniquePtr window(app::load_widget("sprite_properties.xml", "sprite_properties")); + UniquePtr window(app::load_widget("sprite_properties.xml", "sprite_properties")); name = app::find_widget(window, "name"); type = app::find_widget(window, "type"); size = app::find_widget(window, "size"); @@ -135,7 +135,7 @@ void SpritePropertiesCommand::onExecute(Context* context) load_window_pos(window, "SpriteProperties"); window->setVisible(true); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == ok) { if (color_button) { diff --git a/src/commands/cmd_sprite_size.cpp b/src/commands/cmd_sprite_size.cpp index 68b65fab7..75c71b6ce 100644 --- a/src/commands/cmd_sprite_size.cpp +++ b/src/commands/cmd_sprite_size.cpp @@ -197,7 +197,7 @@ void SpriteSizeCommand::onExecute(Context* context) const Sprite* sprite(document ? document->getSprite(): 0); // load the window widget - UniquePtr window(app::load_widget("sprite_size.xml", "sprite_size")); + UniquePtr window(app::load_widget("sprite_size.xml", "sprite_size")); m_widthPx = app::find_widget(window, "width_px"); m_heightPx = app::find_widget(window, "height_px"); m_widthPerc = app::find_widget(window, "width_perc"); @@ -224,7 +224,7 @@ void SpriteSizeCommand::onExecute(Context* context) load_window_pos(window, "SpriteSize"); window->setVisible(true); - window->open_window_fg(); + window->openWindowInForeground(); save_window_pos(window, "SpriteSize"); if (window->get_killer() == ok) { diff --git a/src/commands/filters/cmd_convolution_matrix.cpp b/src/commands/filters/cmd_convolution_matrix.cpp index c5df8352a..2cccecb1a 100644 --- a/src/commands/filters/cmd_convolution_matrix.cpp +++ b/src/commands/filters/cmd_convolution_matrix.cpp @@ -18,8 +18,6 @@ #include "config.h" -#include - #include "app/color.h" #include "app/find_widget.h" #include "app/load_widget.h" @@ -35,13 +33,15 @@ #include "raster/mask.h" #include "raster/sprite.h" #include "ui/button.h" -#include "ui/frame.h" #include "ui/label.h" #include "ui/list.h" #include "ui/listbox.h" #include "ui/slider.h" #include "ui/view.h" #include "ui/widget.h" +#include "ui/window.h" + +#include static const char* ConfigSection = "ConvolutionMatrix"; diff --git a/src/commands/filters/cmd_despeckle.cpp b/src/commands/filters/cmd_despeckle.cpp index e1fdb5ed6..932747009 100644 --- a/src/commands/filters/cmd_despeckle.cpp +++ b/src/commands/filters/cmd_despeckle.cpp @@ -18,8 +18,6 @@ #include "config.h" -#include - #include "app/find_widget.h" #include "app/load_widget.h" #include "base/bind.h" @@ -34,9 +32,11 @@ #include "settings/settings.h" #include "ui/button.h" #include "ui/entry.h" -#include "ui/frame.h" #include "ui/grid.h" #include "ui/widget.h" +#include "ui/window.h" + +#include static const char* ConfigSection = "Despeckle"; diff --git a/src/commands/filters/cmd_invert_color.cpp b/src/commands/filters/cmd_invert_color.cpp index 250af71fd..75f5981ca 100644 --- a/src/commands/filters/cmd_invert_color.cpp +++ b/src/commands/filters/cmd_invert_color.cpp @@ -31,10 +31,10 @@ #include "raster/mask.h" #include "raster/sprite.h" #include "ui/button.h" -#include "ui/frame.h" #include "ui/label.h" #include "ui/slider.h" #include "ui/widget.h" +#include "ui/window.h" #include "widgets/color_button.h" static const char* ConfigSection = "InvertColor"; diff --git a/src/commands/filters/color_curve_editor.cpp b/src/commands/filters/color_curve_editor.cpp index f40785964..3ad2a3db8 100644 --- a/src/commands/filters/color_curve_editor.cpp +++ b/src/commands/filters/color_curve_editor.cpp @@ -24,13 +24,13 @@ #include "filters/color_curve.h" #include "ui/alert.h" #include "ui/entry.h" -#include "ui/frame.h" #include "ui/manager.h" #include "ui/message.h" #include "ui/rect.h" #include "ui/system.h" #include "ui/view.h" #include "ui/widget.h" +#include "ui/window.h" #include #include @@ -359,7 +359,7 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point) gfx::Point point_copy = point; int res; - UniquePtr window(app::load_widget("color_curve.xml", "point_properties")); + UniquePtr window(app::load_widget("color_curve.xml", "point_properties")); entry_x = window->findChild("x"); entry_y = window->findChild("y"); @@ -368,7 +368,7 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point) entry_x->setTextf("%d", point.x); entry_y->setTextf("%d", point.y); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { point.x = entry_x->getTextDouble(); diff --git a/src/commands/filters/filter_window.cpp b/src/commands/filters/filter_window.cpp index f8c7e39ff..5d6597f71 100644 --- a/src/commands/filters/filter_window.cpp +++ b/src/commands/filters/filter_window.cpp @@ -33,7 +33,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection, WithChannels withChannels, WithTiled withTiled, TiledMode tiledMode) - : Frame(false, title) + : Window(false, title) , m_cfgSection(cfgSection) , m_filterMgr(filterMgr) , m_hbox(JI_HORIZONTAL) @@ -103,7 +103,7 @@ bool FilterWindow::doModal() restartPreview(); // Open in foreground - open_window_fg(); + openWindowInForeground(); // Did the user press OK? if (get_killer() == &m_okButton) { diff --git a/src/commands/filters/filter_window.h b/src/commands/filters/filter_window.h index 6e52ba390..fc4eafb2e 100644 --- a/src/commands/filters/filter_window.h +++ b/src/commands/filters/filter_window.h @@ -24,13 +24,13 @@ #include "filters/tiled_mode.h" #include "ui/box.h" #include "ui/button.h" -#include "ui/frame.h" +#include "ui/window.h" class FilterManagerImpl; // A generic window to show parameters for a Filter with integrated // preview in the current editor. -class FilterWindow : public ui::Frame +class FilterWindow : public ui::Window { public: enum WithChannels { WithChannelsSelector, WithoutChannelsSelector }; diff --git a/src/commands/filters/filter_worker.cpp b/src/commands/filters/filter_worker.cpp index e4fafd62b..d80c984c1 100644 --- a/src/commands/filters/filter_worker.cpp +++ b/src/commands/filters/filter_worker.cpp @@ -106,7 +106,7 @@ void FilterWorker::run() base::thread thread(&FilterWorker::thread_proxy, this); // Open the alert window in foreground (this is modal, locks the main thread) - m_alertWindow->open_window_fg(); + m_alertWindow->openWindowInForeground(); // Stop the monitoring timer. m_timer.stop(); diff --git a/src/console.cpp b/src/console.cpp index 57b8e7904..e84ea18a7 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -33,7 +33,7 @@ using namespace ui; -static Frame* wid_console = NULL; +static Window* wid_console = NULL; static Widget* wid_view = NULL; static Widget* wid_textbox = NULL; static Widget* wid_cancel = NULL; @@ -51,7 +51,7 @@ Console::Console() console_counter > 1) return; else { - Frame* window = new Frame(false, "Errors Console"); + Window* window = new Window(false, "Errors Console"); Grid* grid = new Grid(1, false); View* view = new View(); TextBox* textbox = new TextBox(NULL, JI_WORDWRAP); @@ -61,7 +61,7 @@ Console::Console() return; // The "button" closes the console - button->Click.connect(Bind(&Frame::closeWindow, window, button)); + button->Click.connect(Bind(&Window::closeWindow, window, button)); view->attachToView(textbox); @@ -96,7 +96,7 @@ Console::~Console() && !want_close_flag && wid_console->isVisible()) { /* open in foreground */ - wid_console->open_window_fg(); + wid_console->openWindowInForeground(); } delete wid_console; // window @@ -120,7 +120,7 @@ void Console::printf(const char *format, ...) // Open the window if (!wid_console->isVisible()) { - wid_console->open_window(); + wid_console->openWindow(); ui::Manager::getDefault()->invalidate(); } diff --git a/src/dialogs/aniedit.cpp b/src/dialogs/aniedit.cpp index a0b23d2f4..c30ffc3ec 100644 --- a/src/dialogs/aniedit.cpp +++ b/src/dialogs/aniedit.cpp @@ -179,7 +179,7 @@ void switch_between_animation_and_sprite_editor() // Create the window & the animation-editor { - UniquePtr window(new Frame(true, NULL)); + UniquePtr window(new Window(true, NULL)); AnimationEditor* anieditor = new AnimationEditor(document, sprite); current_anieditor = anieditor; @@ -189,7 +189,7 @@ void switch_between_animation_and_sprite_editor() anieditor->centerCurrentCel(); // Show the window - window->open_window_fg(); + window->openWindowInForeground(); // No more animation editor current_anieditor = NULL; diff --git a/src/dialogs/maskcol.cpp b/src/dialogs/maskcol.cpp index a62c5a229..3a7afb0ce 100644 --- a/src/dialogs/maskcol.cpp +++ b/src/dialogs/maskcol.cpp @@ -33,10 +33,10 @@ #include "raster/sprite.h" #include "ui/box.h" #include "ui/button.h" -#include "ui/frame.h" #include "ui/label.h" #include "ui/slider.h" #include "ui/widget.h" +#include "ui/window.h" #include "undo_transaction.h" #include "undoers/set_mask.h" #include "util/misc.h" @@ -75,7 +75,7 @@ void dialogs_mask_color(Document* document) if (!image) return; - UniquePtr window(new Frame(false, "Mask by Color")); + UniquePtr window(new Window(false, "Mask by Color")); box1 = new Box(JI_VERTICAL); box2 = new Box(JI_HORIZONTAL); box3 = new Box(JI_HORIZONTAL); @@ -98,8 +98,8 @@ void dialogs_mask_color(Document* document) button_1->Click.connect(Bind(&button_1_command, button_1, Ref(documentReader))); button_2->Click.connect(Bind(&button_2_command, button_2, Ref(documentReader))); - button_ok->Click.connect(Bind(&Frame::closeWindow, window.get(), button_ok)); - button_cancel->Click.connect(Bind(&Frame::closeWindow, window.get(), button_cancel)); + button_ok->Click.connect(Bind(&Window::closeWindow, window.get(), button_ok)); + button_cancel->Click.connect(Bind(&Window::closeWindow, window.get(), button_cancel)); button_color->Change.connect(Bind(&mask_preview, Ref(documentReader))); slider_tolerance->Change.connect(Bind(&mask_preview, Ref(documentReader))); @@ -135,7 +135,7 @@ void dialogs_mask_color(Document* document) load_window_pos(window, "MaskColor"); // Open the window - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == button_ok) { DocumentWriter documentWriter(documentReader); diff --git a/src/drop_files.cpp b/src/drop_files.cpp index b990c7826..a8592eb71 100644 --- a/src/drop_files.cpp +++ b/src/drop_files.cpp @@ -26,8 +26,8 @@ #include "base/scoped_lock.h" #include "commands/commands.h" #include "commands/params.h" -#include "ui/frame.h" #include "ui/manager.h" +#include "ui/window.h" #include "ui_context.h" #ifdef ALLEGRO_WINDOWS @@ -75,7 +75,7 @@ void check_for_dropped_files() // If the main window is not the current foreground one. We discard // the drop-files event. - if (ui::Manager::getDefault()->getForegroundFrame() != app_get_top_window()) + if (ui::Manager::getDefault()->getForegroundWindow() != app_get_top_window()) return; ScopedLock lock(*dropped_files_mutex); diff --git a/src/file/jpeg_format.cpp b/src/file/jpeg_format.cpp index 7a4b57bf8..169d59917 100644 --- a/src/file/jpeg_format.cpp +++ b/src/file/jpeg_format.cpp @@ -366,13 +366,13 @@ SharedPtr JpegFormat::onGetFormatOptions(FileOp* fop) return jpeg_options; // Load the window to ask to the user the JPEG options he wants. - UniquePtr window(app::load_widget("jpeg_options.xml", "jpeg_options")); + UniquePtr window(app::load_widget("jpeg_options.xml", "jpeg_options")); ui::Slider* slider_quality = app::find_widget(window, "quality"); ui::Widget* ok = app::find_widget(window, "ok"); slider_quality->setValue(jpeg_options->quality * 10.0f); - window->open_window_fg(); + window->openWindowInForeground(); if (window->get_killer() == ok) { jpeg_options->quality = slider_quality->getValue() / 10.0f; diff --git a/src/gfxmode.cpp b/src/gfxmode.cpp index 356d300b2..8e9b1d75e 100644 --- a/src/gfxmode.cpp +++ b/src/gfxmode.cpp @@ -20,8 +20,8 @@ #include -#include "ui/frame.h" #include "ui/manager.h" +#include "ui/window.h" #include "app.h" #include "console.h" diff --git a/src/job.cpp b/src/job.cpp index 1dea79844..169cbce78 100644 --- a/src/job.cpp +++ b/src/job.cpp @@ -24,8 +24,8 @@ #include "base/thread.h" #include "job.h" #include "ui/alert.h" -#include "ui/frame.h" #include "ui/widget.h" +#include "ui/window.h" #include "widgets/status_bar.h" static const int kMonitoringPeriod = 100; @@ -78,7 +78,7 @@ Job::~Job() void Job::startJob() { m_thread = new base::thread(&Job::thread_proc, this); - m_alert_window->open_window_fg(); + m_alert_window->openWindowInForeground(); } void Job::jobProgress(double f) diff --git a/src/modules/editors.cpp b/src/modules/editors.cpp index 4ad256a3a..73b22a8de 100644 --- a/src/modules/editors.cpp +++ b/src/modules/editors.cpp @@ -34,7 +34,7 @@ #include "widgets/editor/editor.h" #include "widgets/editor/editor_customization_delegate.h" #include "widgets/editor/editor_view.h" -#include "widgets/popup_frame_pin.h" +#include "widgets/popup_window_pin.h" #include "widgets/status_bar.h" #include @@ -78,9 +78,9 @@ static Document* get_more_reliable_document(); static Widget* find_next_editor(Widget* widget); static int count_parents(Widget* widget); -static void create_mini_editor_frame(); -static void hide_mini_editor_frame(); -static void update_mini_editor_frame(Editor* editor); +static void create_mini_editor_window(); +static void hide_mini_editor_window(); +static void update_mini_editor_window(Editor* editor); class WrappedEditor : public Editor, public EditorListener, @@ -103,12 +103,12 @@ public: } void scrollChanged(Editor* editor) OVERRIDE { - update_mini_editor_frame(editor); + update_mini_editor_window(editor); } void documentChanged(Editor* editor) OVERRIDE { if (editor == current_editor) - update_mini_editor_frame(editor); + update_mini_editor_window(editor); } void stateChanged(Editor* editor) OVERRIDE { @@ -173,11 +173,11 @@ public: } }; -class MiniEditorFrame : public Frame +class MiniEditorWindow : public Window { public: // Create mini-editor - MiniEditorFrame() : Frame(false, "Mini-Editor") { + MiniEditorWindow() : Window(false, "Mini-Editor") { child_spacing = 0; set_autoremap(false); set_wantfocus(false); @@ -190,7 +190,7 @@ protected: closeButton->getId() == SkinTheme::kThemeCloseButtonId) { // Here we don't use "enable_mini_editor" to change the state of // "mini_editor_enabled" because we're coming from a close event - // of the frame. + // of the window. mini_editor_enabled = false; // Redraw the tool bar because it shows the mini editor enabled state. @@ -200,7 +200,7 @@ protected: } }; -static MiniEditorFrame* mini_editor_frame = NULL; +static MiniEditorWindow* mini_editor_window = NULL; int init_module_editors() { @@ -212,11 +212,11 @@ void exit_module_editors() { set_config_bool("MiniEditor", "Enabled", mini_editor_enabled); - if (mini_editor_frame) { - save_window_pos(mini_editor_frame, "MiniEditor"); + if (mini_editor_window) { + save_window_pos(mini_editor_window, "MiniEditor"); - delete mini_editor_frame; - mini_editor_frame = NULL; + delete mini_editor_window; + mini_editor_window = NULL; } ASSERT(editors.empty()); @@ -389,7 +389,7 @@ void set_current_editor(Editor* editor) app_refresh_screen(document); app_rebuild_documents_tabs(); - update_mini_editor_frame(editor); + update_mini_editor_window(editor); } } @@ -582,7 +582,7 @@ void enable_mini_editor(bool state) { mini_editor_enabled = state; - update_mini_editor_frame(current_editor); + update_mini_editor_window(current_editor); } static int is_document_in_some_editor(Document* document) @@ -637,10 +637,10 @@ static int count_parents(Widget* widget) return count; } -static void create_mini_editor_frame() +static void create_mini_editor_window() { // Create mini-editor - mini_editor_frame = new MiniEditorFrame(); + mini_editor_window = new MiniEditorWindow(); // Create the new for the mini editor View* newView = new EditorView(EditorView::AlwaysSelected); @@ -652,31 +652,31 @@ static void create_mini_editor_frame() newView->attachToView(mini_editor); - mini_editor_frame->addChild(newView); + mini_editor_window->addChild(newView); // Default bounds int width = JI_SCREEN_W/4; int height = JI_SCREEN_H/4; - mini_editor_frame->setBounds + mini_editor_window->setBounds (gfx::Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc), JI_SCREEN_H - height - jrect_h(app_get_statusbar()->rc), width, height)); - load_window_pos(mini_editor_frame, "MiniEditor"); + load_window_pos(mini_editor_window, "MiniEditor"); } -static void hide_mini_editor_frame() +static void hide_mini_editor_window() { - if (mini_editor_frame && - mini_editor_frame->isVisible()) { - mini_editor_frame->closeWindow(NULL); + if (mini_editor_window && + mini_editor_window->isVisible()) { + mini_editor_window->closeWindow(NULL); } } -static void update_mini_editor_frame(Editor* editor) +static void update_mini_editor_window(Editor* editor) { if (!mini_editor_enabled || !editor) { - hide_mini_editor_frame(); + hide_mini_editor_window(); return; } @@ -688,12 +688,12 @@ static void update_mini_editor_frame(Editor* editor) if (document && document->getSprite() && ((!mini_editor && editor->getZoom() > 0) || (mini_editor && mini_editor->getZoom() != editor->getZoom()))) { - // If the mini frame does not exist, create it - if (!mini_editor_frame) - create_mini_editor_frame(); + // If the mini window does not exist, create it + if (!mini_editor_window) + create_mini_editor_window(); - if (!mini_editor_frame->isVisible()) - mini_editor_frame->open_window_bg(); + if (!mini_editor_window->isVisible()) + mini_editor_window->openWindow(); gfx::Rect visibleBounds = editor->getVisibleSpriteBounds(); gfx::Point pt = visibleBounds.getCenter(); @@ -708,6 +708,6 @@ static void update_mini_editor_frame(Editor* editor) mini_editor->centerInSpritePoint(pt.x, pt.y); } else { - hide_mini_editor_frame(); + hide_mini_editor_window(); } } diff --git a/src/modules/gui.cpp b/src/modules/gui.cpp index 29eba1007..ceb823b42 100644 --- a/src/modules/gui.cpp +++ b/src/modules/gui.cpp @@ -952,12 +952,12 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg) break; case JM_KEYPRESSED: { - Frame* toplevel_frame = getTopFrame(); + Window* toplevel_window = getTopWindow(); // If there is a foreground window as top level... - if (toplevel_frame && - toplevel_frame != app_get_top_window() && - toplevel_frame->is_foreground()) { + if (toplevel_window && + toplevel_window != app_get_top_window() && + toplevel_window->is_foreground()) { // We just do not process keyboard shortcuts for menus and tools break; } @@ -1022,7 +1022,7 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg) // the current window running at foreground. JLink link; JI_LIST_FOR_EACH(this->children, link) { - Frame* child = reinterpret_cast(link->data); + Window* child = reinterpret_cast(link->data); // There are a foreground window executing? if (child->is_foreground()) { diff --git a/src/modules/gui.h b/src/modules/gui.h index 789000279..55211400d 100644 --- a/src/modules/gui.h +++ b/src/modules/gui.h @@ -33,9 +33,10 @@ class Params; namespace ui { class ButtonBase; class CheckBox; - class Frame; class RadioButton; class Widget; + class Window; + union Message; } namespace tools { class Tool; } diff --git a/src/skin/skin_theme.cpp b/src/skin/skin_theme.cpp index 27ae5b478..47ab893a0 100644 --- a/src/skin/skin_theme.cpp +++ b/src/skin/skin_theme.cpp @@ -82,7 +82,7 @@ protected: return true; case JM_DRAW: - static_cast(getTheme())->draw_frame_button(this, &msg->draw.rect); + static_cast(getTheme())->drawWindowButton(this, &msg->draw.rect); return true; case JM_KEYPRESSED: @@ -696,8 +696,8 @@ void SkinTheme::init_widget(Widget* widget) widget->child_spacing = 0; break; - case JI_FRAME: - if (!static_cast(widget)->is_desktop()) { + case JI_WINDOW: + if (!static_cast(widget)->is_desktop()) { if (widget->hasText()) { BORDER4(6 * scale, (4+6) * scale, 6 * scale, 6 * scale); widget->border_width.t += jwidget_get_text_height(widget); @@ -1246,7 +1246,7 @@ void SkinTheme::draw_separator(Widget* widget, JRect clip) { int x1, y1, x2, y2; - // frame position + // position x1 = widget->rc->x1 + widget->border_width.l/2; y1 = widget->rc->y1 + widget->border_width.t/2; x2 = widget->rc->x2 - 1 - widget->border_width.r/2; @@ -1578,9 +1578,9 @@ void SkinTheme::draw_view_viewport(Widget* widget, JRect clip) jdraw_rectfill(widget->rc, BGCOLOR); } -void SkinTheme::paintFrame(PaintEvent& ev) +void SkinTheme::paintWindow(PaintEvent& ev) { - Frame* window = static_cast(ev.getSource()); + Window* window = static_cast(ev.getSource()); JRect pos = jwidget_get_rect(window); JRect cpos = jwidget_get_child_rect(window); @@ -1621,7 +1621,7 @@ void SkinTheme::paintFrame(PaintEvent& ev) jrect_free(cpos); } -void SkinTheme::draw_frame_button(ButtonBase* widget, JRect clip) +void SkinTheme::drawWindowButton(ButtonBase* widget, JRect clip) { int part; diff --git a/src/skin/skin_theme.h b/src/skin/skin_theme.h index 542c83028..9db3b4bfa 100644 --- a/src/skin/skin_theme.h +++ b/src/skin/skin_theme.h @@ -90,8 +90,8 @@ public: void draw_view(ui::Widget* widget, ui::JRect clip); void draw_view_scrollbar(ui::Widget* widget, ui::JRect clip); void draw_view_viewport(ui::Widget* widget, ui::JRect clip); - void paintFrame(ui::PaintEvent& ev); - void draw_frame_button(ui::ButtonBase* widget, ui::JRect clip); + void paintWindow(ui::PaintEvent& ev); + void drawWindowButton(ui::ButtonBase* widget, ui::JRect clip); void paintTooltip(ui::PaintEvent& ev); int get_button_normal_text_color() const { return makecol(0, 0, 0); } diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 59dc88b18..bf3fcb737 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -15,7 +15,6 @@ add_library(ui-lib event.cpp font.cpp fontbmp.cpp - frame.cpp graphics.cpp grid.cpp gui.cpp @@ -29,7 +28,7 @@ add_library(ui-lib menu.cpp message.cpp paint_event.cpp - popup_frame.cpp + popup_window.cpp preferred_size_event.cpp property.cpp rect.cpp @@ -45,4 +44,5 @@ add_library(ui-lib tooltips.cpp view.cpp viewport.cpp - widget.cpp) + widget.cpp + window.cpp) diff --git a/src/ui/alert.cpp b/src/ui/alert.cpp index 2b50f0d2a..d91e08a5d 100644 --- a/src/ui/alert.cpp +++ b/src/ui/alert.cpp @@ -40,7 +40,7 @@ namespace ui { Alert::Alert() - : Frame(false, "") + : Window(false, "") { // Do nothing } @@ -84,7 +84,7 @@ int Alert::show(const char* format, ...) window->processString(buf, labels, buttons); // Open it - window->open_window_fg(); + window->openWindowInForeground(); // Check the killer int ret = 0; @@ -147,7 +147,7 @@ void Alert::processString(char* buf, std::vector& labels, std::vectorsetId(buttonId); - button_widget->Click.connect(Bind(&Frame::closeWindow, this, button_widget)); + button_widget->Click.connect(Bind(&Window::closeWindow, this, button_widget)); } buf[c] = chr; diff --git a/src/ui/alert.h b/src/ui/alert.h index 1deb3e943..601b1b5e5 100644 --- a/src/ui/alert.h +++ b/src/ui/alert.h @@ -8,14 +8,14 @@ #define UI_ALERT_H_INCLUDED #include "base/shared_ptr.h" -#include "ui/frame.h" +#include "ui/window.h" namespace ui { class Alert; typedef SharedPtr AlertPtr; - class Alert : public Frame + class Alert : public Window { public: Alert(); diff --git a/src/ui/base.h b/src/ui/base.h index 89ee4eea3..c828c202d 100644 --- a/src/ui/base.h +++ b/src/ui/base.h @@ -37,11 +37,6 @@ namespace ui { struct jrect; struct jregion; - class Frame; - class Theme; - class Widget; - union Message; - // Alignment. #define JI_HORIZONTAL 0x0001 #define JI_VERTICAL 0x0002 @@ -98,7 +93,7 @@ namespace ui { JI_VIEW, JI_VIEW_SCROLLBAR, JI_VIEW_VIEWPORT, - JI_FRAME, + JI_WINDOW, // User widgets. JI_USER_WIDGET, diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 94ff905e7..a6ced7f38 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -6,14 +6,7 @@ #include "config.h" -#include -#include -#include -#include -#include - #include "ui/button.h" -#include "ui/frame.h" #include "ui/list.h" #include "ui/manager.h" #include "ui/message.h" @@ -21,6 +14,13 @@ #include "ui/rect.h" #include "ui/theme.h" #include "ui/widget.h" +#include "ui/window.h" + +#include +#include +#include +#include +#include namespace ui { diff --git a/src/ui/combobox.cpp b/src/ui/combobox.cpp index f4f924b87..061aef9e6 100644 --- a/src/ui/combobox.cpp +++ b/src/ui/combobox.cpp @@ -439,7 +439,7 @@ void ComboBox::onButtonClick(Event& ev) void ComboBox::openListBox() { if (!m_window) { - m_window = new Frame(false, NULL); + m_window = new Window(false, NULL); View* view = new View(); m_listbox = new ComboBoxListBox(this); @@ -474,7 +474,7 @@ void ComboBox::openListBox() getManager()->addMessageFilter(JM_BUTTONPRESSED, this); - m_window->open_window_bg(); + m_window->openWindow(); getManager()->setFocus(m_listbox); } } diff --git a/src/ui/combobox.h b/src/ui/combobox.h index 1b4f70de4..a0a31ab55 100644 --- a/src/ui/combobox.h +++ b/src/ui/combobox.h @@ -18,8 +18,8 @@ namespace ui { class Button; class Entry; - class Frame; class ListBox; + class Window; class ComboBox : public Widget { @@ -74,7 +74,7 @@ namespace ui { Entry* m_entry; Button* m_button; - Frame* m_window; + Window* m_window; ListBox* m_listbox; std::vector m_items; int m_selected; diff --git a/src/ui/gui.h b/src/ui/gui.h index 724e2fff7..a8fddf5b8 100644 --- a/src/ui/gui.h +++ b/src/ui/gui.h @@ -20,7 +20,6 @@ #include "ui/entry.h" #include "ui/event.h" #include "ui/font.h" -#include "ui/frame.h" #include "ui/graphics.h" #include "ui/grid.h" #include "ui/hit_test_event.h" @@ -34,7 +33,7 @@ #include "ui/menu.h" #include "ui/message.h" #include "ui/paint_event.h" -#include "ui/popup_frame.h" +#include "ui/popup_window.h" #include "ui/preferred_size_event.h" #include "ui/property.h" #include "ui/rect.h" @@ -52,5 +51,6 @@ #include "ui/viewport.h" #include "ui/widget.h" #include "ui/widgets_list.h" +#include "ui/window.h" #endif diff --git a/src/ui/intern.cpp b/src/ui/intern.cpp index 6060b6557..29a5d40fc 100644 --- a/src/ui/intern.cpp +++ b/src/ui/intern.cpp @@ -6,10 +6,10 @@ #include "config.h" -#include "ui/frame.h" #include "ui/manager.h" #include "ui/theme.h" #include "ui/widget.h" +#include "ui/window.h" #include @@ -62,8 +62,8 @@ void _ji_reinit_theme_in_all_widgets() // Remap the windows for (std::list::iterator it=widgets->begin(), end=widgets->end(); it != end; ++it) { - if ((*it)->type == JI_FRAME) - static_cast(*it)->remap_window(); + if ((*it)->type == JI_WINDOW) + static_cast(*it)->remap_window(); } // Redraw the whole screen diff --git a/src/ui/intern.h b/src/ui/intern.h index 355069ad0..6dab79c27 100644 --- a/src/ui/intern.h +++ b/src/ui/intern.h @@ -14,8 +14,8 @@ struct BITMAP; namespace ui { - class Frame; class Widget; + class Window; ////////////////////////////////////////////////////////////////////// // jintern.c diff --git a/src/ui/manager.cpp b/src/ui/manager.cpp index 8e062a21f..6ba5f53c6 100644 --- a/src/ui/manager.cpp +++ b/src/ui/manager.cpp @@ -380,7 +380,7 @@ bool Manager::generateMessages() if (msg->type == JM_BUTTONPRESSED && !capture_widget && mouse_widget) { // The clicked window - Frame* window = mouse_widget->getRoot(); + Window* window = mouse_widget->getRoot(); Manager* win_manager = (window ? window->getManager(): NULL); if ((window) && @@ -391,7 +391,7 @@ bool Manager::generateMessages() // which should be kept on top of the foreground one. (!window->is_foreground()) && // If the window is not already the top window of the manager. - (window != win_manager->getTopFrame())) { + (window != win_manager->getTopWindow())) { // Put it in the top of the list jlist_remove(win_manager->children, window); @@ -400,7 +400,7 @@ bool Manager::generateMessages() else { int pos = jlist_length(win_manager->children); JI_LIST_FOR_EACH_BACK(win_manager->children, link) { - if (((Frame*)link->data)->is_ontop()) + if (((Window*)link->data)->is_ontop()) break; pos--; } @@ -531,19 +531,19 @@ void Manager::enqueueMessage(Message* msg) jmessage_free(msg); } -Frame* Manager::getTopFrame() +Window* Manager::getTopWindow() { - return reinterpret_cast(jlist_first_data(this->children)); + return reinterpret_cast(jlist_first_data(this->children)); } -Frame* Manager::getForegroundFrame() +Window* Manager::getForegroundWindow() { JLink link; JI_LIST_FOR_EACH(this->children, link) { - Frame* frame = (Frame*)link->data; - if (frame->is_foreground() || - frame->is_desktop()) - return frame; + Window* window = (Window*)link->data; + if (window->is_foreground() || + window->is_desktop()) + return window; } return NULL; } @@ -832,7 +832,7 @@ void Manager::removeMessageFilterFor(Widget* widget) } /* configures the window for begin the loop */ -void Manager::_openWindow(Frame* window) +void Manager::_openWindow(Window* window) { // Free all widgets of special states. if (window->is_wantfocus()) { @@ -854,7 +854,7 @@ void Manager::_openWindow(Frame* window) jlist_append(new_windows, window); } -void Manager::_closeWindow(Frame* window, bool redraw_background) +void Manager::_closeWindow(Window* window, bool redraw_background) { Message* msg; JRegion reg1; @@ -879,7 +879,7 @@ void Manager::_closeWindow(Frame* window, bool redraw_background) jregion_union(reg1, reg1, reg2); jregion_free(reg2); - _closeWindow(reinterpret_cast(link->data), false); + _closeWindow(reinterpret_cast(link->data), false); } } } @@ -938,7 +938,7 @@ bool Manager::onProcessMessage(Message* msg) // Continue sending the message to the children of all windows // (until a desktop or foreground window). JI_LIST_FOR_EACH(this->children, link) { - Frame* w = (Frame*)link->data; + Window* w = (Window*)link->data; // Send to the window. JI_LIST_FOR_EACH(w->children, link2) @@ -964,7 +964,7 @@ bool Manager::onProcessMessage(Message* msg) void Manager::onBroadcastMouseMessage(WidgetsList& targets) { - // Ask to the first frame in the "children" list to know how to + // Ask to the first window in the "children" list to know how to // propagate mouse messages. Widget* widget = reinterpret_cast(jlist_first_data(children)); if (widget) @@ -1169,7 +1169,7 @@ void Manager::invalidateDisplayRegion(const JRegion region) // Redraw windows from top to background. JI_LIST_FOR_EACH(this->children, link) { - Frame* window = (Frame*)link->data; + Window* window = (Window*)link->data; // Invalidate regions of this window window->invalidateRegion(reg1); @@ -1316,7 +1316,7 @@ static bool move_focus(Manager* manager, Message* msg) Widget* focus = NULL; Widget* it; bool ret = false; - Frame* window = NULL; + Window* window = NULL; int c, count; // Who have the focus @@ -1324,7 +1324,7 @@ static bool move_focus(Manager* manager, Message* msg) window = focus_widget->getRoot(); } else if (!jlist_empty(manager->children)) { - window = manager->getTopFrame(); + window = manager->getTopWindow(); } if (!window) diff --git a/src/ui/manager.h b/src/ui/manager.h index fd35164b0..1d740d469 100644 --- a/src/ui/manager.h +++ b/src/ui/manager.h @@ -12,7 +12,7 @@ namespace ui { - class Frame; + class Window; class Timer; class Manager : public Widget @@ -35,8 +35,8 @@ namespace ui { void enqueueMessage(Message* msg); - Frame* getTopFrame(); - Frame* getForegroundFrame(); + Window* getTopWindow(); + Window* getForegroundWindow(); Widget* getFocus(); Widget* getMouse(); @@ -61,8 +61,8 @@ namespace ui { void invalidateDisplayRegion(const JRegion region); - void _openWindow(Frame* window); - void _closeWindow(Frame* frame, bool redraw_background); + void _openWindow(Window* window); + void _closeWindow(Window* window, bool redraw_background); protected: bool onProcessMessage(Message* msg) OVERRIDE; diff --git a/src/ui/menu.cpp b/src/ui/menu.cpp index 732af2ab7..c8680b472 100644 --- a/src/ui/menu.cpp +++ b/src/ui/menu.cpp @@ -72,11 +72,11 @@ struct MenuBaseData }; -class CustomizedWindowForMenuBox : public Frame +class CustomizedWindowForMenuBox : public Window { public: CustomizedWindowForMenuBox(MenuBox* menubox) - : Frame(false, NULL) + : Window(false, NULL) { set_moveable(false); // Can't move the window addChild(menubox); @@ -94,7 +94,7 @@ protected: break; } - return Frame::onProcessMessage(msg); + return Window::onProcessMessage(msg); } }; @@ -259,7 +259,7 @@ void Menu::showPopup(int x, int y) } while (jmouse_b(0)); // New window and new menu-box - Frame* window = new Frame(false, NULL); + Window* window = new Window(false, NULL); MenuBox* menubox = new MenuBox(); MenuBaseData* base = menubox->createBase(); base->was_clicked = true; @@ -283,7 +283,7 @@ void Menu::showPopup(int x, int y) menubox->setFocusMagnet(true); // Open the window - window->open_window_fg(); + window->openWindowInForeground(); // Free the keyboard focus Manager::getDefault()->freeFocus(); @@ -748,7 +748,7 @@ bool MenuItem::onProcessMessage(Message* msg) menubox->setMenu(m_submenu); // New window and new menu-box - Frame* window = new CustomizedWindowForMenuBox(menubox); + Window* window = new CustomizedWindowForMenuBox(menubox); // Menubox position pos = jwidget_get_rect(window); @@ -825,7 +825,7 @@ bool MenuItem::onProcessMessage(Message* msg) m_submenu->unhighlightItem(); // Run in background - window->open_window_bg(); + window->openWindow(); base->is_processing = false; @@ -834,7 +834,7 @@ bool MenuItem::onProcessMessage(Message* msg) } else if (msg->type == JM_CLOSE_MENUITEM) { MenuBaseData* base = get_base(this); - Frame* window; + Window* window; bool last_of_close_chain = (msg->user.a ? true: false); ASSERT(base != NULL); @@ -845,8 +845,8 @@ bool MenuItem::onProcessMessage(Message* msg) ASSERT(menubox != NULL); - window = (Frame*)menubox->parent; - ASSERT(window && window->type == JI_FRAME); + window = (Window*)menubox->parent; + ASSERT(window && window->type == JI_WINDOW); // Fetch the "menu" to avoid destroy it with 'delete'. menubox->setMenu(NULL); diff --git a/src/ui/message.h b/src/ui/message.h index 7f8669bb2..3679677b3 100644 --- a/src/ui/message.h +++ b/src/ui/message.h @@ -13,6 +13,7 @@ namespace ui { class Timer; + class Widget; /* TODO add mutexes */ #define JM_MESSAGE(name) \ diff --git a/src/ui/popup_frame.cpp b/src/ui/popup_window.cpp similarity index 88% rename from src/ui/popup_frame.cpp rename to src/ui/popup_window.cpp index fc13a5ba8..fb04eb415 100644 --- a/src/ui/popup_frame.cpp +++ b/src/ui/popup_window.cpp @@ -19,8 +19,8 @@ using namespace gfx; namespace ui { -PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed) - : Frame(false, text) +PopupWindow::PopupWindow(const char* text, bool close_on_buttonpressed) + : Window(false, text) { m_close_on_buttonpressed = close_on_buttonpressed; m_hot_region = NULL; @@ -40,7 +40,7 @@ PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed) jwidget_noborders(this); } -PopupFrame::~PopupFrame() +PopupWindow::~PopupWindow() { stopFilteringMessages(); @@ -52,7 +52,7 @@ PopupFrame::~PopupFrame() * @param region The new hot-region. This pointer is holded by the @a widget. * So you cannot destroy it after calling this routine. */ -void PopupFrame::setHotRegion(JRegion region) +void PopupWindow::setHotRegion(JRegion region) { ASSERT(region != NULL); @@ -64,19 +64,19 @@ void PopupFrame::setHotRegion(JRegion region) m_hot_region = region; } -void PopupFrame::makeFloating() +void PopupWindow::makeFloating() { stopFilteringMessages(); set_moveable(true); } -void PopupFrame::makeFixed() +void PopupWindow::makeFixed() { startFilteringMessages(); set_moveable(false); } -bool PopupFrame::onProcessMessage(Message* msg) +bool PopupWindow::onProcessMessage(Message* msg) { switch (msg->type) { @@ -98,7 +98,7 @@ bool PopupFrame::onProcessMessage(Message* msg) } // If we are filtering messages we don't propagate key-events - // to other widgets. As we're a popup frame and we're + // to other widgets. As we're a popup window and we're // filtering messages, the user shouldn't be able to start // other actions pressing keyboard shortcuts. return false; @@ -135,10 +135,10 @@ bool PopupFrame::onProcessMessage(Message* msg) } - return Frame::onProcessMessage(msg); + return Window::onProcessMessage(msg); } -void PopupFrame::onPreferredSize(PreferredSizeEvent& ev) +void PopupWindow::onPreferredSize(PreferredSizeEvent& ev) { ScreenGraphics g; g.setFont(getFont()); @@ -174,7 +174,7 @@ void PopupFrame::onPreferredSize(PreferredSizeEvent& ev) ev.setPreferredSize(resultSize); } -void PopupFrame::onPaint(PaintEvent& ev) +void PopupWindow::onPaint(PaintEvent& ev) { Graphics* g = ev.getGraphics(); gfx::Rect pos = getClientBounds(); @@ -188,7 +188,7 @@ void PopupFrame::onPaint(PaintEvent& ev) g->drawString(getText(), ji_color_foreground(), this->getBgColor(), pos, getAlign()); } -void PopupFrame::onInitTheme(InitThemeEvent& ev) +void PopupWindow::onInitTheme(InitThemeEvent& ev) { Widget::onInitTheme(ev); @@ -198,7 +198,7 @@ void PopupFrame::onInitTheme(InitThemeEvent& ev) this->border_width.b = 3 * jguiscale(); } -void PopupFrame::startFilteringMessages() +void PopupWindow::startFilteringMessages() { if (!m_filtering) { m_filtering = true; @@ -210,7 +210,7 @@ void PopupFrame::startFilteringMessages() } } -void PopupFrame::stopFilteringMessages() +void PopupWindow::stopFilteringMessages() { if (m_filtering) { m_filtering = false; diff --git a/src/ui/popup_frame.h b/src/ui/popup_window.h similarity index 77% rename from src/ui/popup_frame.h rename to src/ui/popup_window.h index e36935dc0..fece73781 100644 --- a/src/ui/popup_frame.h +++ b/src/ui/popup_window.h @@ -4,19 +4,19 @@ // This source file is ditributed under a BSD-like license, please // read LICENSE.txt for more information. -#ifndef UI_POPUP_FRAME_H_INCLUDED -#define UI_POPUP_FRAME_H_INCLUDED +#ifndef UI_POPUP_WINDOW_H_INCLUDED +#define UI_POPUP_WINDOW_H_INCLUDED #include "base/compiler_specific.h" -#include "ui/frame.h" +#include "ui/window.h" namespace ui { - class PopupFrame : public Frame + class PopupWindow : public Window { public: - PopupFrame(const char* text, bool close_on_buttonpressed); - ~PopupFrame(); + PopupWindow(const char* text, bool close_on_buttonpressed); + ~PopupWindow(); void setHotRegion(JRegion region); diff --git a/src/ui/theme.h b/src/ui/theme.h index 5fafe1918..0d9607238 100644 --- a/src/ui/theme.h +++ b/src/ui/theme.h @@ -19,6 +19,7 @@ namespace ui { class Menu; class MenuItem; class PaintEvent; + class Widget; class Theme { @@ -69,7 +70,7 @@ namespace ui { virtual void draw_view(Widget* widget, JRect clip) = 0; virtual void draw_view_scrollbar(Widget* widget, JRect clip) = 0; virtual void draw_view_viewport(Widget* widget, JRect clip) = 0; - virtual void paintFrame(PaintEvent& ev) = 0; + virtual void paintWindow(PaintEvent& ev) = 0; virtual void paintTooltip(PaintEvent& ev) = 0; protected: diff --git a/src/ui/tooltips.cpp b/src/ui/tooltips.cpp index a81544974..012633928 100644 --- a/src/ui/tooltips.cpp +++ b/src/ui/tooltips.cpp @@ -143,7 +143,7 @@ void TooltipManager::onTick() m_tipWindow->position_window(MID(0, x, JI_SCREEN_W-w), MID(0, y, JI_SCREEN_H-h)); - m_tipWindow->open_window(); + m_tipWindow->openWindow(); } m_timer->stop(); } @@ -151,7 +151,7 @@ void TooltipManager::onTick() // TipWindow TipWindow::TipWindow(const char *text, bool close_on_buttonpressed) - : Frame(false, text) + : Window(false, text) { JLink link, next; @@ -269,7 +269,7 @@ bool TipWindow::onProcessMessage(Message* msg) } - return Frame::onProcessMessage(msg); + return Window::onProcessMessage(msg); } void TipWindow::onPreferredSize(PreferredSizeEvent& ev) @@ -307,7 +307,7 @@ void TipWindow::onPreferredSize(PreferredSizeEvent& ev) void TipWindow::onInitTheme(InitThemeEvent& ev) { - Frame::onInitTheme(ev); + Window::onInitTheme(ev); this->border_width.l = 6 * jguiscale(); this->border_width.t = 6 * jguiscale(); diff --git a/src/ui/tooltips.h b/src/ui/tooltips.h index c70b9ce8c..51fa3dfa2 100644 --- a/src/ui/tooltips.h +++ b/src/ui/tooltips.h @@ -9,7 +9,7 @@ #include "base/compiler_specific.h" #include "ui/base.h" -#include "ui/frame.h" +#include "ui/window.h" #include @@ -51,7 +51,7 @@ namespace ui { } m_target; }; - class TipWindow : public Frame + class TipWindow : public Window { public: TipWindow(const char *text, bool close_on_buttonpressed = false); diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index 10c4878bc..058a194a5 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -346,13 +346,13 @@ bool Widget::isFocusMagnet() const // PARENTS & CHILDREN // =============================================================== -Frame* Widget::getRoot() +Window* Widget::getRoot() { Widget* widget = this; while (widget) { - if (widget->type == JI_FRAME) - return dynamic_cast(widget); + if (widget->type == JI_WINDOW) + return dynamic_cast(widget); widget = widget->parent; } @@ -595,7 +595,7 @@ JRegion jwidget_get_region(Widget* widget) ASSERT_VALID_WIDGET(widget); - if (widget->type == JI_FRAME) + if (widget->type == JI_WINDOW) region = widget->getTheme()->get_window_mask(widget); else region = jregion_new(widget->rc, 1); @@ -1071,8 +1071,8 @@ bool Widget::sendMessage(Message* msg) void Widget::closeWindow() { - if (Frame* frame = getRoot()) - frame->closeWindow(this); + if (Window* window = getRoot()) + window->closeWindow(this); } void Widget::broadcastMouseMessage(WidgetsList& targets) diff --git a/src/ui/widget.h b/src/ui/widget.h index e47537dbd..de9d709a5 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h @@ -25,11 +25,14 @@ struct BITMAP; namespace ui { - class PaintEvent; - class PreferredSizeEvent; + union Message; + class InitThemeEvent; class Manager; - class Frame; + class PaintEvent; + class PreferredSizeEvent; + class Theme; + class Window; int ji_register_widget_type(); @@ -193,7 +196,7 @@ namespace ui { // PARENTS & CHILDREN // =============================================================== - Frame* getRoot(); + Window* getRoot(); Widget* getParent(); Manager* getManager(); diff --git a/src/ui/frame.cpp b/src/ui/window.cpp similarity index 92% rename from src/ui/frame.cpp rename to src/ui/window.cpp index 093359895..d09a7224a 100644 --- a/src/ui/frame.cpp +++ b/src/ui/window.cpp @@ -33,8 +33,8 @@ static int press_x, press_y; static void displace_widgets(Widget* widget, int x, int y); -Frame::Frame(bool desktop, const char* text) - : Widget(JI_FRAME) +Window::Window(bool desktop, const char* text) + : Widget(JI_WINDOW) { m_killer = NULL; m_is_desktop = desktop; @@ -52,55 +52,55 @@ Frame::Frame(bool desktop, const char* text) initTheme(); } -Frame::~Frame() +Window::~Window() { getManager()->_closeWindow(this, false); } -Widget* Frame::get_killer() +Widget* Window::get_killer() { return m_killer; } -void Frame::set_autoremap(bool state) +void Window::set_autoremap(bool state) { m_is_autoremap = state; } -void Frame::set_moveable(bool state) +void Window::set_moveable(bool state) { m_is_moveable = state; } -void Frame::set_sizeable(bool state) +void Window::set_sizeable(bool state) { m_is_sizeable = state; } -void Frame::set_ontop(bool state) +void Window::set_ontop(bool state) { m_is_ontop = state; } -void Frame::set_wantfocus(bool state) +void Window::set_wantfocus(bool state) { m_is_wantfocus = state; } -HitTest Frame::hitTest(const gfx::Point& point) +HitTest Window::hitTest(const gfx::Point& point) { HitTestEvent ev(this, point, HitTestNowhere); onHitTest(ev); return ev.getHit(); } -void Frame::onClose(CloseEvent& ev) +void Window::onClose(CloseEvent& ev) { // Fire Close signal Close(ev); } -void Frame::onHitTest(HitTestEvent& ev) +void Window::onHitTest(HitTestEvent& ev) { HitTest ht = HitTestNowhere; @@ -168,7 +168,7 @@ void Frame::onHitTest(HitTestEvent& ev) ev.setHit(ht); } -void Frame::remap_window() +void Window::remap_window() { Size reqSize; JRect rect; @@ -189,7 +189,7 @@ void Frame::remap_window() invalidate(); } -void Frame::center_window() +void Window::center_window() { Widget* manager = getManager(); @@ -200,7 +200,7 @@ void Frame::center_window() jrect_h(manager->rc)/2 - jrect_h(this->rc)/2); } -void Frame::position_window(int x, int y) +void Window::position_window(int x, int y) { JRect rect; @@ -214,12 +214,12 @@ void Frame::position_window(int x, int y) invalidate(); } -void Frame::move_window(JRect rect) +void Window::move_window(JRect rect) { move_window(rect, true); } -void Frame::open_window() +void Window::openWindow() { if (!this->parent) { if (m_is_autoremap) @@ -229,9 +229,9 @@ void Frame::open_window() } } -void Frame::open_window_fg() +void Window::openWindowInForeground() { - open_window(); + openWindow(); Manager* manager = getManager(); @@ -245,12 +245,7 @@ void Frame::open_window_fg() m_is_foreground = false; } -void Frame::open_window_bg() -{ - this->open_window(); -} - -void Frame::closeWindow(Widget* killer) +void Window::closeWindow(Widget* killer) { m_killer = killer; @@ -261,7 +256,7 @@ void Frame::closeWindow(Widget* killer) onClose(ev); } -bool Frame::is_toplevel() +bool Window::is_toplevel() { Widget* manager = getManager(); @@ -271,7 +266,7 @@ bool Frame::is_toplevel() return false; } -bool Frame::onProcessMessage(Message* msg) +bool Window::onProcessMessage(Message* msg) { switch (msg->type) { @@ -450,7 +445,7 @@ bool Frame::onProcessMessage(Message* msg) return Widget::onProcessMessage(msg); } -void Frame::onPreferredSize(PreferredSizeEvent& ev) +void Window::onPreferredSize(PreferredSizeEvent& ev) { Widget* manager = getManager(); @@ -485,17 +480,17 @@ void Frame::onPreferredSize(PreferredSizeEvent& ev) } } -void Frame::onPaint(PaintEvent& ev) +void Window::onPaint(PaintEvent& ev) { - getTheme()->paintFrame(ev); + getTheme()->paintWindow(ev); } -void Frame::onBroadcastMouseMessage(WidgetsList& targets) +void Window::onBroadcastMouseMessage(WidgetsList& targets) { targets.push_back(this); - // Continue sending the message to siblings frames until a desktop - // or foreground frame. + // Continue sending the message to siblings windows until a desktop + // or foreground window. if (is_foreground() || is_desktop()) return; @@ -504,13 +499,13 @@ void Frame::onBroadcastMouseMessage(WidgetsList& targets) sibling->broadcastMouseMessage(targets); } -void Frame::onSetText() +void Window::onSetText() { Widget::onSetText(); initTheme(); } -void Frame::window_set_position(JRect rect) +void Window::window_set_position(JRect rect) { Widget* child; JRect cpos; @@ -533,13 +528,13 @@ void Frame::window_set_position(JRect rect) jrect_free(cpos); } -void Frame::limit_size(int *w, int *h) +void Window::limit_size(int *w, int *h) { *w = MAX(*w, this->border_width.l+this->border_width.r); *h = MAX(*h, this->border_width.t+this->border_width.b); } -void Frame::move_window(JRect rect, bool use_blit) +void Window::move_window(JRect rect, bool use_blit) { #define FLAGS JI_GDR_CUTTOPWINDOWS | JI_GDR_USECHILDAREA diff --git a/src/ui/frame.h b/src/ui/window.h similarity index 90% rename from src/ui/frame.h rename to src/ui/window.h index f800cc1af..afbb6d887 100644 --- a/src/ui/frame.h +++ b/src/ui/window.h @@ -4,8 +4,8 @@ // This source file is ditributed under a BSD-like license, please // read LICENSE.txt for more information. -#ifndef UI_FRAME_H_INCLUDED -#define UI_FRAME_H_INCLUDED +#ifndef UI_WINDOW_H_INCLUDED +#define UI_WINDOW_H_INCLUDED #include "base/compiler_specific.h" #include "base/signal.h" @@ -17,11 +17,11 @@ namespace ui { - class Frame : public Widget + class Window : public Widget { public: - Frame(bool is_desktop, const char* text); - ~Frame(); + Window(bool is_desktop, const char* text); + ~Window(); Widget* get_killer(); @@ -36,9 +36,8 @@ namespace ui { void position_window(int x, int y); void move_window(JRect rect); - void open_window(); - void open_window_fg(); - void open_window_bg(); + void openWindow(); + void openWindowInForeground(); void closeWindow(Widget* killer); bool is_toplevel(); diff --git a/src/widgets/color_button.cpp b/src/widgets/color_button.cpp index 6abc88e3e..e326d814a 100644 --- a/src/widgets/color_button.cpp +++ b/src/widgets/color_button.cpp @@ -49,7 +49,7 @@ ColorButton::ColorButton(const Color& color, PixelFormat pixelFormat) : ButtonBase("", colorbutton_type(), JI_BUTTON, JI_BUTTON) , m_color(color) , m_pixelFormat(pixelFormat) - , m_frame(NULL) + , m_window(NULL) { this->setFocusStop(true); @@ -58,7 +58,7 @@ ColorButton::ColorButton(const Color& color, PixelFormat pixelFormat) ColorButton::~ColorButton() { - delete m_frame; // widget, frame + delete m_window; // widget, window } PixelFormat ColorButton::getPixelFormat() const @@ -81,9 +81,9 @@ void ColorButton::setColor(const Color& color) { m_color = color; - // Change the color in its related frame - if (m_frame) - m_frame->setColor(m_color, ColorSelector::DoNotChangeType); + // Change the color in its related window + if (m_window) + m_window->setColor(m_color, ColorSelector::DoNotChangeType); // Emit signal Change(color); @@ -96,8 +96,8 @@ bool ColorButton::onProcessMessage(Message* msg) switch (msg->type) { case JM_CLOSE: - if (m_frame && m_frame->isVisible()) - m_frame->closeWindow(NULL); + if (m_window && m_window->isVisible()) + m_window->closeWindow(NULL); break; case JM_MOUSEENTER: @@ -219,11 +219,11 @@ void ColorButton::onClick(Event& ev) ButtonBase::onClick(ev); // If the popup window was not created or shown yet.. - if (m_frame == NULL || !m_frame->isVisible()) { + if (m_window == NULL || !m_window->isVisible()) { // Open it openSelectorDialog(); } - else if (!m_frame->is_moveable()) { + else if (!m_window->is_moveable()) { // If it is visible, close it closeSelectorDialog(); } @@ -233,46 +233,46 @@ void ColorButton::openSelectorDialog() { int x, y; - if (m_frame == NULL) { - m_frame = new ColorSelector(); - m_frame->user_data[0] = this; - m_frame->ColorChange.connect(&ColorButton::onFrameColorChange, this); + if (m_window == NULL) { + m_window = new ColorSelector(); + m_window->user_data[0] = this; + m_window->ColorChange.connect(&ColorButton::onWindowColorChange, this); } - m_frame->setColor(m_color, ColorSelector::ChangeType); - m_frame->open_window(); + m_window->setColor(m_color, ColorSelector::ChangeType); + m_window->openWindow(); - x = MID(0, this->rc->x1, JI_SCREEN_W-jrect_w(m_frame->rc)); - if (this->rc->y2 <= JI_SCREEN_H-jrect_h(m_frame->rc)) + x = MID(0, this->rc->x1, JI_SCREEN_W-jrect_w(m_window->rc)); + if (this->rc->y2 <= JI_SCREEN_H-jrect_h(m_window->rc)) y = MAX(0, this->rc->y2); else - y = MAX(0, this->rc->y1-jrect_h(m_frame->rc)); + y = MAX(0, this->rc->y1-jrect_h(m_window->rc)); - m_frame->position_window(x, y); + m_window->position_window(x, y); - m_frame->getManager()->dispatchMessages(); - m_frame->layout(); + m_window->getManager()->dispatchMessages(); + m_window->layout(); /* setup the hot-region */ { - JRect rc = jrect_new(MIN(this->rc->x1, m_frame->rc->x1)-8, - MIN(this->rc->y1, m_frame->rc->y1)-8, - MAX(this->rc->x2, m_frame->rc->x2)+8, - MAX(this->rc->y2, m_frame->rc->y2)+8); + JRect rc = jrect_new(MIN(this->rc->x1, m_window->rc->x1)-8, + MIN(this->rc->y1, m_window->rc->y1)-8, + MAX(this->rc->x2, m_window->rc->x2)+8, + MAX(this->rc->y2, m_window->rc->y2)+8); JRegion rgn = jregion_new(rc, 1); jrect_free(rc); - static_cast(m_frame)->setHotRegion(rgn); + static_cast(m_window)->setHotRegion(rgn); } } void ColorButton::closeSelectorDialog() { - if (m_frame != NULL) - m_frame->closeWindow(NULL); + if (m_window != NULL) + m_window->closeWindow(NULL); } -void ColorButton::onFrameColorChange(const Color& color) +void ColorButton::onWindowColorChange(const Color& color) { setColor(color); } diff --git a/src/widgets/color_button.h b/src/widgets/color_button.h index 1b669fa5e..bc10ccef6 100644 --- a/src/widgets/color_button.h +++ b/src/widgets/color_button.h @@ -52,11 +52,11 @@ protected: private: void openSelectorDialog(); void closeSelectorDialog(); - void onFrameColorChange(const Color& color); + void onWindowColorChange(const Color& color); Color m_color; PixelFormat m_pixelFormat; - ColorSelector* m_frame; + ColorSelector* m_window; }; #endif diff --git a/src/widgets/color_selector.cpp b/src/widgets/color_selector.cpp index 250e1907a..c84ad2f95 100644 --- a/src/widgets/color_selector.cpp +++ b/src/widgets/color_selector.cpp @@ -38,7 +38,7 @@ using namespace ui; ColorSelector::ColorSelector() - : PopupFramePin("Color Selector", false) + : PopupWindowPin("Color Selector", false) , m_color(Color::fromMask()) , m_vbox(JI_VERTICAL) , m_topBox(JI_HORIZONTAL) diff --git a/src/widgets/color_selector.h b/src/widgets/color_selector.h index 05164d22a..84ea057dc 100644 --- a/src/widgets/color_selector.h +++ b/src/widgets/color_selector.h @@ -28,9 +28,9 @@ #include "widgets/color_sliders.h" #include "widgets/hex_color_entry.h" #include "widgets/palette_view.h" -#include "widgets/popup_frame_pin.h" +#include "widgets/popup_window_pin.h" -class ColorSelector : public PopupFramePin +class ColorSelector : public PopupWindowPin { public: enum SetColorOptions { diff --git a/src/widgets/file_selector.cpp b/src/widgets/file_selector.cpp index 3b6d64fb4..9df7459d5 100644 --- a/src/widgets/file_selector.cpp +++ b/src/widgets/file_selector.cpp @@ -167,7 +167,7 @@ public: }; FileSelector::FileSelector() - : Frame(false, "") + : Window(false, "") { app::WidgetLoader loader; loader.addWidgetType("filenameentry", new CustomFileNameEntryCreator); @@ -316,7 +316,7 @@ base::string FileSelector::show(const base::string& title, // open the window and run... the user press ok? again: - open_window_fg(); + openWindowInForeground(); if (get_killer() == ok || get_killer() == m_fileList) { // open the selected file diff --git a/src/widgets/file_selector.h b/src/widgets/file_selector.h index 9b424c8cd..a40d05ee5 100644 --- a/src/widgets/file_selector.h +++ b/src/widgets/file_selector.h @@ -21,7 +21,7 @@ #include "base/string.h" #include "base/unique_ptr.h" -#include "ui/frame.h" +#include "ui/window.h" class IFileItem; @@ -36,7 +36,7 @@ namespace widgets { class FileList; class CustomFileNameEntry; - class FileSelector : public ui::Frame + class FileSelector : public ui::Window { public: FileSelector(); diff --git a/src/widgets/popup_frame_pin.cpp b/src/widgets/popup_window_pin.cpp similarity index 82% rename from src/widgets/popup_frame_pin.cpp rename to src/widgets/popup_window_pin.cpp index 6b0ece1c6..c8c032d26 100644 --- a/src/widgets/popup_frame_pin.cpp +++ b/src/widgets/popup_window_pin.cpp @@ -18,7 +18,7 @@ #include "config.h" -#include "widgets/popup_frame_pin.h" +#include "widgets/popup_window_pin.h" #include "base/bind.h" #include "gfx/border.h" @@ -33,8 +33,8 @@ using namespace ui; -PopupFramePin::PopupFramePin(const char* text, bool close_on_buttonpressed) - : PopupFrame(text, close_on_buttonpressed) +PopupWindowPin::PopupWindowPin(const char* text, bool close_on_buttonpressed) + : PopupWindow(text, close_on_buttonpressed) , m_pin("") { // Configure the micro check-box look without borders, only the "pin" icon is shown. @@ -42,12 +42,12 @@ PopupFramePin::PopupFramePin(const char* text, bool close_on_buttonpressed) m_pin.child_spacing = 0; m_pin.setBorder(gfx::Border(0)); - m_pin.Click.connect(&PopupFramePin::onPinClick, this); + m_pin.Click.connect(&PopupWindowPin::onPinClick, this); set_gfxicon_to_button(&m_pin, PART_UNPINNED, PART_PINNED, PART_UNPINNED, JI_CENTER | JI_MIDDLE); } -void PopupFramePin::onPinClick(Event& ev) +void PopupWindowPin::onPinClick(Event& ev) { if (m_pin.isSelected()) { makeFloating(); @@ -62,7 +62,7 @@ void PopupFramePin::onPinClick(Event& ev) } } -bool PopupFramePin::onProcessMessage(Message* msg) +bool PopupWindowPin::onProcessMessage(Message* msg) { switch (msg->type) { @@ -77,12 +77,12 @@ bool PopupFramePin::onProcessMessage(Message* msg) } - return PopupFrame::onProcessMessage(msg); + return PopupWindow::onProcessMessage(msg); } -void PopupFramePin::onHitTest(HitTestEvent& ev) +void PopupWindowPin::onHitTest(HitTestEvent& ev) { - PopupFrame::onHitTest(ev); + PopupWindow::onHitTest(ev); if (m_pin.isSelected() && ev.getHit() == HitTestClient) { diff --git a/src/widgets/popup_frame_pin.h b/src/widgets/popup_window_pin.h similarity index 90% rename from src/widgets/popup_frame_pin.h rename to src/widgets/popup_window_pin.h index 67bc61cb6..4a6d12c40 100644 --- a/src/widgets/popup_frame_pin.h +++ b/src/widgets/popup_window_pin.h @@ -20,12 +20,12 @@ #define WIDGETS_POPUP_FRAME_PIN_H_INCLUDED #include "ui/button.h" -#include "ui/popup_frame.h" +#include "ui/popup_window.h" -class PopupFramePin : public ui::PopupFrame +class PopupWindowPin : public ui::PopupWindow { public: - PopupFramePin(const char* text, bool close_on_buttonpressed); + PopupWindowPin(const char* text, bool close_on_buttonpressed); protected: virtual bool onProcessMessage(ui::Message* msg) OVERRIDE; diff --git a/src/widgets/status_bar.cpp b/src/widgets/status_bar.cpp index 304012561..abd3711f0 100644 --- a/src/widgets/status_bar.cpp +++ b/src/widgets/status_bar.cpp @@ -337,7 +337,7 @@ void StatusBar::showTip(int msecs, const char *format, ...) if (m_tipwindow->isVisible()) m_tipwindow->closeWindow(NULL); - m_tipwindow->open_window(); + m_tipwindow->openWindow(); m_tipwindow->remap_window(); x = this->rc->x2 - jrect_w(m_tipwindow->rc); diff --git a/src/widgets/status_bar.h b/src/widgets/status_bar.h index 7df320725..b499bf425 100644 --- a/src/widgets/status_bar.h +++ b/src/widgets/status_bar.h @@ -36,8 +36,8 @@ namespace ui { class Box; class Button; class Entry; - class Frame; class Slider; + class Window; } namespace tools { diff --git a/src/widgets/toolbar.cpp b/src/widgets/toolbar.cpp index 5763ee452..88c6b6a0b 100644 --- a/src/widgets/toolbar.cpp +++ b/src/widgets/toolbar.cpp @@ -60,7 +60,7 @@ class ToolBar : public Widget bool m_open_on_hot; // Window displayed to show a tool-group - PopupFrame* m_popupFrame; + PopupWindow* m_popupWindow; // Tool-tip window TipWindow* m_tipWindow; @@ -87,7 +87,7 @@ protected: private: int getToolGroupIndex(ToolGroup* group); - void openPopupFrame(int group_index, ToolGroup* group); + void openPopupWindow(int group_index, ToolGroup* group); Rect getToolGroupBounds(int group_index); Point getToolPositionInGroup(int group_index, Tool* tool); void openTipWindow(int group_index, Tool* tool); @@ -95,7 +95,7 @@ private: }; // Class to show a group of tools (horizontally) -// This widget is inside the ToolBar::m_popupFrame +// This widget is inside the ToolBar::m_popupWindow class ToolStrip : public Widget { ToolGroup* m_group; @@ -158,7 +158,7 @@ ToolBar::ToolBar() m_hot_tool = NULL; m_hot_index = NoneIndex; m_open_on_hot = false; - m_popupFrame = NULL; + m_popupWindow = NULL; m_tipWindow = NULL; m_tipOpened = false; @@ -172,7 +172,7 @@ ToolBar::ToolBar() ToolBar::~ToolBar() { - delete m_popupFrame; + delete m_popupWindow; delete m_tipWindow; } @@ -300,7 +300,7 @@ bool ToolBar::onProcessMessage(Message* msg) UIContext::instance()->getSettings()->setCurrentTool(tool); invalidate(); - openPopupFrame(c, tool_group); + openPopupWindow(c, tool_group); } } @@ -339,7 +339,7 @@ bool ToolBar::onProcessMessage(Message* msg) new_hot_index = c; if ((m_open_on_hot) && (m_hot_tool != new_hot_tool)) - openPopupFrame(c, tool_group); + openPopupWindow(c, tool_group); break; } } @@ -375,7 +375,7 @@ bool ToolBar::onProcessMessage(Message* msg) case JM_MOUSELEAVE: closeTipWindow(); - if (!m_popupFrame) + if (!m_popupWindow) m_tipOpened = false; m_hot_tool = NULL; @@ -388,7 +388,7 @@ bool ToolBar::onProcessMessage(Message* msg) case JM_TIMER: if (msg->timer.timer == &m_tipTimer) { if (m_tipWindow) - m_tipWindow->open_window(); + m_tipWindow->openWindow(); m_tipTimer.stop(); m_tipOpened = true; @@ -414,13 +414,13 @@ int ToolBar::getToolGroupIndex(ToolGroup* group) return -1; } -void ToolBar::openPopupFrame(int group_index, ToolGroup* tool_group) +void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group) { // Close the current popup window - if (m_popupFrame) { - m_popupFrame->closeWindow(NULL); - delete m_popupFrame; - m_popupFrame = NULL; + if (m_popupWindow) { + m_popupWindow->closeWindow(NULL); + delete m_popupWindow; + m_popupWindow = NULL; } // Close tip window @@ -439,11 +439,11 @@ void ToolBar::openPopupFrame(int group_index, ToolGroup* tool_group) // In case this tool contains more than just one tool, show the popup window m_open_on_hot = true; - m_popupFrame = new PopupFrame(NULL, false); - m_popupFrame->Close.connect(Bind(&ToolBar::onClosePopup, this)); + m_popupWindow = new PopupWindow(NULL, false); + m_popupWindow->Close.connect(Bind(&ToolBar::onClosePopup, this)); ToolStrip* toolstrip = new ToolStrip(tool_group, this); - m_popupFrame->addChild(toolstrip); + m_popupWindow->addChild(toolstrip); Rect rc = getToolGroupBounds(group_index); int w = 0; @@ -475,13 +475,13 @@ void ToolBar::openPopupFrame(int group_index, ToolGroup* tool_group) { jrect rc2 = { rc.x, rc.y, this->rc->x2, rc.y+rc.h }; JRegion hotregion = jregion_new(&rc2, 1); - m_popupFrame->setHotRegion(hotregion); + m_popupWindow->setHotRegion(hotregion); } - m_popupFrame->set_autoremap(false); - m_popupFrame->setBounds(rc); + m_popupWindow->set_autoremap(false); + m_popupWindow->setBounds(rc); toolstrip->setBounds(rc); - m_popupFrame->open_window(); + m_popupWindow->openWindow(); toolstrip->setBounds(rc); } @@ -582,14 +582,14 @@ void ToolBar::openTipWindow(int group_index, Tool* tool) Point arrow = tool ? getToolPositionInGroup(group_index, tool): Point(0, 0); int w = jrect_w(m_tipWindow->rc); int h = jrect_h(m_tipWindow->rc); - int x = toolrc.x - w + (tool && m_popupFrame && m_popupFrame->isVisible() ? arrow.x-m_popupFrame->getBounds().w: 0); + int x = toolrc.x - w + (tool && m_popupWindow && m_popupWindow->isVisible() ? arrow.x-m_popupWindow->getBounds().w: 0); int y = toolrc.y + toolrc.h; m_tipWindow->position_window(MID(0, x, JI_SCREEN_W-w), MID(0, y, JI_SCREEN_H-h)); if (m_tipOpened) - m_tipWindow->open_window(); + m_tipWindow->openWindow(); else m_tipTimer.start(); }