Skip to content

Commit

Permalink
Rename ui::Frame to ui::Window.
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Jul 9, 2012
1 parent a35aa75 commit 91bf743
Show file tree
Hide file tree
Showing 77 changed files with 415 additions and 419 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class AppTabsDelegate : public TabsDelegate

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 */
Expand Down Expand Up @@ -185,7 +185,7 @@ int App::run()
ui::Manager::getDefault()->invalidate();

// Load main window
top_window = app::load_widget<Frame>("main_window.xml", "main_window");
top_window = app::load_widget<Window>("main_window.xml", "main_window");

box_menubar = top_window->findChild("menubar");
box_editors = top_window->findChild("editor");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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; }
Expand Down
5 changes: 3 additions & 2 deletions src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class StatusBar;
class Tabs;

namespace ui {
class Frame;
class MenuBar;
class Widget;
class Window;
}

namespace tools { class ToolBox; }
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/app/widget_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions src/commands/cmd_about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ AboutCommand::AboutCommand()

void AboutCommand::onExecute(Context* context)
{
UniquePtr<Frame> frame(new Frame(false, "About " PACKAGE));
UniquePtr<Window> 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);
Expand Down Expand Up @@ -92,17 +92,17 @@ 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(),
close_button->border_width.t,
close_button->border_width.r + 16*jguiscale(),
close_button->border_width.b);

close_button->Click.connect(Bind<void>(&Frame::closeWindow, frame.get(), close_button));
close_button->Click.connect(Bind<void>(&Window::closeWindow, window.get(), close_button));

frame->open_window_fg();
window->openWindowInForeground();
}

//////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cmd_advanced_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void AdvancedModeCommand::onExecute(Context* context)
char key[1024];
char buf[1024];

UniquePtr<Frame> window(app::load_widget<Frame>("advanced_mode.xml", "advanced_mode_warning"));
UniquePtr<Window> window(app::load_widget<Window>("advanced_mode.xml", "advanced_mode_warning"));
Widget* warning_label = app::find_widget<Widget>(window, "warning_label");
Widget* donot_show = app::find_widget<Widget>(window, "donot_show");

Expand All @@ -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());
}
Expand Down
26 changes: 13 additions & 13 deletions src/commands/cmd_canvas_size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -71,15 +71,15 @@ class CanvasSizeFrame : public Frame
m_top->setTextf("%d", top);
m_bottom->setTextf("%d", bottom);

m_left ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_right ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_top ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_bottom->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_left ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_right ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_top ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_bottom->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));

m_editor->setState(m_selectBoxState);
}

~CanvasSizeFrame()
~CanvasSizeWindow()
{
m_editor->backToPreviousState();
}
Expand Down Expand Up @@ -120,7 +120,7 @@ class CanvasSizeFrame : public Frame

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));
Expand Down Expand Up @@ -174,14 +174,14 @@ void CanvasSizeCommand::onExecute(Context* context)

if (context->isUiAvailable()) {
// load the window widget
UniquePtr<CanvasSizeFrame> window(new CanvasSizeFrame(0, 0, 0, 0));
UniquePtr<CanvasSizeWindow> 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())
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cmd_cel_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void CelPropertiesCommand::onExecute(Context* context)
// Get current cel (can be NULL)
const Cel* cel = static_cast<const LayerImage*>(layer)->getCel(sprite->getCurrentFrame());

UniquePtr<Frame> window(app::load_widget<Frame>("cel_properties.xml", "cel_properties"));
UniquePtr<Window> window(app::load_widget<Window>("cel_properties.xml", "cel_properties"));
Widget* label_frame = app::find_widget<Widget>(window, "frame");
Widget* label_pos = app::find_widget<Widget>(window, "pos");
Widget* label_size = app::find_widget<Widget>(window, "size");
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/cmd_configure_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -270,7 +270,7 @@ void ConfigureTools::onExecute(Context* context)
bool first_time = false;

if (!window) {
window = app::load_widget<Frame>("tools_configuration.xml", "configure_tool");
window = app::load_widget<Window>("tools_configuration.xml", "configure_tool");
first_time = true;
}
/* if the window is opened, close it */
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions src/commands/cmd_developer_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -96,7 +96,7 @@ void DeveloperConsoleCommand::onExecute(Context* context)
}

m_devConsole->updateDocuments(context);
m_devConsole->open_window_bg();
m_devConsole->openWindow();
}

//////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cmd_duplicate_sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
char buf[1024];

/* load the window widget */
UniquePtr<Frame> window(app::load_widget<Frame>("duplicate_sprite.xml", "duplicate_sprite"));
UniquePtr<Window> window(app::load_widget<Window>("duplicate_sprite.xml", "duplicate_sprite"));

src_name = window->findChild("src_name");
dst_name = window->findChild("dst_name");
Expand All @@ -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());
Expand Down
18 changes: 9 additions & 9 deletions src/commands/cmd_export_sprite_sheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -87,14 +87,14 @@ class ExportSpriteSheetFrame : public Frame
m_grid.addChildInCell(hbox1, 4, 1, 0);
}

m_sheetType.Change.connect(&ExportSpriteSheetFrame::onSheetTypeChange, this);
m_export.Click.connect(Bind<void>(&ExportSpriteSheetFrame::onExport, this));
m_cancel.Click.connect(Bind<void>(&ExportSpriteSheetFrame::onCancel, this));
m_sheetType.Change.connect(&ExportSpriteSheetWindow::onSheetTypeChange, this);
m_export.Click.connect(Bind<void>(&ExportSpriteSheetWindow::onExport, this));
m_cancel.Click.connect(Bind<void>(&ExportSpriteSheetWindow::onCancel, this));

onSheetTypeChange();
}

~ExportSpriteSheetFrame()
~ExportSpriteSheetWindow()
{
}

Expand Down Expand Up @@ -316,8 +316,8 @@ bool ExportSpriteSheetCommand::onEnabled(Context* context)

void ExportSpriteSheetCommand::onExecute(Context* context)
{
UniquePtr<Frame> frame(new ExportSpriteSheetFrame(context));
frame->open_window_fg();
UniquePtr<Window> window(new ExportSpriteSheetWindow(context));
window->openWindowInForeground();
}

//////////////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions src/commands/cmd_frame_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void FramePropertiesCommand::onExecute(Context* context)
const ActiveDocumentReader document(context);
const Sprite* sprite = document->getSprite();

UniquePtr<Frame> window(app::load_widget<Frame>("frame_duration.xml", "frame_duration"));
UniquePtr<Window> window(app::load_widget<Window>("frame_duration.xml", "frame_duration"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* frlen = app::find_widget<Widget>(window, "frlen");
Widget* ok = app::find_widget<Widget>(window, "ok");
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/commands/cmd_goto_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <allegro/unicode.h>
Expand Down Expand Up @@ -235,13 +235,13 @@ bool GotoFrameCommand::onEnabled(Context* context)
void GotoFrameCommand::onExecute(Context* context)
{
if (m_frame == 0 && context->isUiAvailable()) {
UniquePtr<Frame> window(app::load_widget<Frame>("goto_frame.xml", "goto_frame"));
UniquePtr<Window> window(app::load_widget<Window>("goto_frame.xml", "goto_frame"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* ok = app::find_widget<Widget>(window, "ok");

frame->setTextf("%d", context->getActiveDocument()->getSprite()->getCurrentFrame()+1);

window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() != ok)
return;

Expand Down
Loading

0 comments on commit 91bf743

Please sign in to comment.