mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 09:40:42 +00:00
Remove jwidget_find_name() function.
This commit is contained in:
parent
0bd6e19093
commit
d57677d80b
12
src/app.cpp
12
src/app.cpp
@ -174,12 +174,12 @@ int App::run()
|
||||
// Load main window
|
||||
top_window = static_cast<Frame*>(load_widget("main_window.xml", "main_window"));
|
||||
|
||||
box_menubar = jwidget_find_name(top_window, "menubar");
|
||||
box_editors = jwidget_find_name(top_window, "editor");
|
||||
box_colorbar = jwidget_find_name(top_window, "colorbar");
|
||||
box_toolbar = jwidget_find_name(top_window, "toolbar");
|
||||
box_statusbar = jwidget_find_name(top_window, "statusbar");
|
||||
box_tabsbar = jwidget_find_name(top_window, "tabsbar");
|
||||
box_menubar = top_window->findChild("menubar");
|
||||
box_editors = top_window->findChild("editor");
|
||||
box_colorbar = top_window->findChild("colorbar");
|
||||
box_toolbar = top_window->findChild("toolbar");
|
||||
box_statusbar = top_window->findChild("statusbar");
|
||||
box_tabsbar = top_window->findChild("tabsbar");
|
||||
|
||||
menubar = jmenubar_new();
|
||||
statusbar = new StatusBar();
|
||||
|
@ -264,7 +264,7 @@ void ConfigureTools::onExecute(Context* context)
|
||||
brush_preview_msg_proc, NULL);
|
||||
}
|
||||
else {
|
||||
brush_preview = jwidget_find_name(window, "brush_preview");
|
||||
brush_preview = window->findChild("brush_preview");
|
||||
}
|
||||
|
||||
// Current settings
|
||||
|
@ -66,9 +66,9 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
||||
/* load the window widget */
|
||||
FramePtr window(load_widget("duplicate_sprite.xml", "duplicate_sprite"));
|
||||
|
||||
src_name = jwidget_find_name(window, "src_name");
|
||||
dst_name = jwidget_find_name(window, "dst_name");
|
||||
flatten = jwidget_find_name(window, "flatten");
|
||||
src_name = window->findChild("src_name");
|
||||
dst_name = window->findChild("dst_name");
|
||||
flatten = window->findChild("flatten");
|
||||
|
||||
src_name->setText(get_filename(document->getFilename()));
|
||||
|
||||
@ -81,7 +81,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
||||
/* open the window */
|
||||
window->open_window_fg();
|
||||
|
||||
if (window->get_killer() == jwidget_find_name(window, "ok")) {
|
||||
if (window->get_killer() == window->findChild("ok")) {
|
||||
set_config_bool("DuplicateSprite", "Flatten", flatten->isSelected());
|
||||
|
||||
// make a copy of the document
|
||||
|
@ -96,10 +96,10 @@ void NewLayerCommand::onExecute(Context* context)
|
||||
|
||||
window->open_window_fg();
|
||||
|
||||
if (window->get_killer() != jwidget_find_name(window, "ok"))
|
||||
if (window->get_killer() != window->findChild("ok"))
|
||||
return;
|
||||
|
||||
name = jwidget_find_name(window, "name")->getText();
|
||||
name = window->findChild("name")->getText();
|
||||
}
|
||||
|
||||
Layer* layer;
|
||||
|
@ -64,8 +64,8 @@ void NewLayerSetCommand::onExecute(Context* context)
|
||||
|
||||
window->open_window_fg();
|
||||
|
||||
if (window->get_killer() == jwidget_find_name(window, "ok")) {
|
||||
const char *name = jwidget_find_name(window, "name")->getText();
|
||||
if (window->get_killer() == window->findChild("ok")) {
|
||||
const char *name = window->findChild("name")->getText();
|
||||
Layer* layer = new LayerFolder(sprite);
|
||||
|
||||
layer->setName(name);
|
||||
|
@ -358,9 +358,9 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point)
|
||||
|
||||
FramePtr window(load_widget("color_curve.xml", "point_properties"));
|
||||
|
||||
entry_x = jwidget_find_name(window, "x");
|
||||
entry_y = jwidget_find_name(window, "y");
|
||||
button_ok = jwidget_find_name(window, "button_ok");
|
||||
entry_x = window->findChild("x");
|
||||
entry_y = window->findChild("y");
|
||||
button_ok = window->findChild("button_ok");
|
||||
|
||||
entry_x->setTextf("%d", point.x);
|
||||
entry_y->setTextf("%d", point.y);
|
||||
|
@ -58,19 +58,19 @@ static bool navigation_locked = false; /* if true the navigation_history isn't
|
||||
changes (used when the back/forward
|
||||
buttons are pushed) */
|
||||
|
||||
static void update_location(JWidget window);
|
||||
static void update_navigation_buttons(JWidget window);
|
||||
static void update_location(Widget* window);
|
||||
static void update_navigation_buttons(Widget* window);
|
||||
static void add_in_navigation_history(IFileItem* folder);
|
||||
static void select_filetype_from_filename(JWidget window);
|
||||
static void select_filetype_from_filename(Widget* window);
|
||||
|
||||
static void goback_command(JWidget widget);
|
||||
static void goforward_command(JWidget widget);
|
||||
static void goup_command(JWidget widget);
|
||||
static void goback_command(Widget* widget);
|
||||
static void goforward_command(Widget* widget);
|
||||
static void goup_command(Widget* widget);
|
||||
|
||||
static bool fileview_msg_proc(JWidget widget, JMessage msg);
|
||||
static bool location_msg_proc(JWidget widget, JMessage msg);
|
||||
static bool filetype_msg_proc(JWidget widget, JMessage msg);
|
||||
static bool filename_msg_proc(JWidget widget, JMessage msg);
|
||||
static bool fileview_msg_proc(Widget* widget, JMessage msg);
|
||||
static bool location_msg_proc(Widget* widget, JMessage msg);
|
||||
static bool filetype_msg_proc(Widget* widget, JMessage msg);
|
||||
static bool filename_msg_proc(Widget* widget, JMessage msg);
|
||||
|
||||
// Slot for App::Exit signal
|
||||
static void on_exit_delete_navigation_history()
|
||||
@ -145,11 +145,11 @@ base::string ase_file_selector(const base::string& message,
|
||||
// load the window widget
|
||||
window = static_cast<Frame*>(load_widget("file_selector.xml", "file_selector"));
|
||||
|
||||
JWidget box = jwidget_find_name(window, "box");
|
||||
Widget* box = window->findChild("box");
|
||||
Button* goback = window->findChildT<Button>("goback");
|
||||
Button* goforward = window->findChildT<Button>("goforward");
|
||||
Button* goup = window->findChildT<Button>("goup");
|
||||
JWidget location = window->findChild("location");
|
||||
Widget* location = window->findChild("location");
|
||||
filetype = window->findChildT<ComboBox>("filetype");
|
||||
ASSERT(filetype != NULL);
|
||||
filename_entry = window->findChildT<Entry>("filename");
|
||||
@ -202,7 +202,7 @@ base::string ase_file_selector(const base::string& message,
|
||||
window->center_window();
|
||||
}
|
||||
else {
|
||||
fileview = jwidget_find_name(window, "fileview");
|
||||
fileview = window->findChild("fileview");
|
||||
filetype = window->findChildT<ComboBox>("filetype");
|
||||
ASSERT(filetype != NULL);
|
||||
filename_entry = window->findChildT<Entry>("filename");
|
||||
@ -239,7 +239,7 @@ base::string ase_file_selector(const base::string& message,
|
||||
window->setText(message.c_str());
|
||||
|
||||
// get the ok-button
|
||||
JWidget ok = jwidget_find_name(window, "ok");
|
||||
Widget* ok = window->findChild("ok");
|
||||
|
||||
// update the view
|
||||
View::getView(fileview)->updateView();
|
||||
@ -373,10 +373,10 @@ again:
|
||||
* Updates the content of the combo-box that shows the current
|
||||
* location in the file-system.
|
||||
*/
|
||||
static void update_location(JWidget window)
|
||||
static void update_location(Widget* window)
|
||||
{
|
||||
JWidget fileview = jwidget_find_name(window, "fileview");
|
||||
ComboBox* location = dynamic_cast<ComboBox*>(jwidget_find_name(window, "location"));
|
||||
Widget* fileview = window->findChild("fileview");
|
||||
ComboBox* location = dynamic_cast<ComboBox*>(window->findChild("location"));
|
||||
ASSERT(location != NULL);
|
||||
|
||||
IFileItem* current_folder = fileview_get_current_folder(fileview);
|
||||
@ -452,12 +452,12 @@ static void update_location(JWidget window)
|
||||
jlist_free(locations);
|
||||
}
|
||||
|
||||
static void update_navigation_buttons(JWidget window)
|
||||
static void update_navigation_buttons(Widget* window)
|
||||
{
|
||||
JWidget fileview = jwidget_find_name(window, "fileview");
|
||||
JWidget goback = jwidget_find_name(window, "goback");
|
||||
JWidget goforward = jwidget_find_name(window, "goforward");
|
||||
JWidget goup = jwidget_find_name(window, "goup");
|
||||
Widget* fileview = window->findChild("fileview");
|
||||
Widget* goback = window->findChild("goback");
|
||||
Widget* goforward = window->findChild("goforward");
|
||||
Widget* goup = window->findChild("goup");
|
||||
IFileItem* current_folder = fileview_get_current_folder(fileview);
|
||||
|
||||
/* update the state of the go back button: if the navigation-history
|
||||
@ -507,10 +507,10 @@ static void add_in_navigation_history(IFileItem* folder)
|
||||
}
|
||||
}
|
||||
|
||||
static void select_filetype_from_filename(JWidget window)
|
||||
static void select_filetype_from_filename(Widget* window)
|
||||
{
|
||||
JWidget entry = jwidget_find_name(window, "filename");
|
||||
ComboBox* filetype = dynamic_cast<ComboBox*>(jwidget_find_name(window, "filetype"));
|
||||
Widget* entry = window->findChild("filename");
|
||||
ComboBox* filetype = dynamic_cast<ComboBox*>(window->findChild("filetype"));
|
||||
ASSERT(filetype != NULL);
|
||||
|
||||
const char *filename = entry->getText();
|
||||
@ -524,9 +524,9 @@ static void select_filetype_from_filename(JWidget window)
|
||||
}
|
||||
}
|
||||
|
||||
static void goback_command(JWidget widget)
|
||||
static void goback_command(Widget* widget)
|
||||
{
|
||||
JWidget fileview = widget->findSibling("fileview");
|
||||
Widget* fileview = widget->findSibling("fileview");
|
||||
|
||||
if (jlist_length(navigation_history) > 1) {
|
||||
if (!navigation_position)
|
||||
@ -543,9 +543,9 @@ static void goback_command(JWidget widget)
|
||||
}
|
||||
}
|
||||
|
||||
static void goforward_command(JWidget widget)
|
||||
static void goforward_command(Widget* widget)
|
||||
{
|
||||
JWidget fileview = widget->findSibling("fileview");
|
||||
Widget* fileview = widget->findSibling("fileview");
|
||||
|
||||
if (jlist_length(navigation_history) > 1) {
|
||||
if (!navigation_position)
|
||||
@ -562,14 +562,14 @@ static void goforward_command(JWidget widget)
|
||||
}
|
||||
}
|
||||
|
||||
static void goup_command(JWidget widget)
|
||||
static void goup_command(Widget* widget)
|
||||
{
|
||||
JWidget fileview = widget->findSibling("fileview");
|
||||
Widget* fileview = widget->findSibling("fileview");
|
||||
fileview_goup(fileview);
|
||||
}
|
||||
|
||||
/* hook for the 'fileview' widget in the dialog */
|
||||
static bool fileview_msg_proc(JWidget widget, JMessage msg)
|
||||
static bool fileview_msg_proc(Widget* widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_SIGNAL) {
|
||||
switch (msg->signal.num) {
|
||||
@ -611,7 +611,7 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
// Hook for the 'location' combo-box
|
||||
static bool location_msg_proc(JWidget widget, JMessage msg)
|
||||
static bool location_msg_proc(Widget* widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_SIGNAL) {
|
||||
ComboBox* combobox = dynamic_cast<ComboBox*>(widget);
|
||||
@ -649,7 +649,7 @@ static bool location_msg_proc(JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
// Hook for the 'filetype' combo-box
|
||||
static bool filetype_msg_proc(JWidget widget, JMessage msg)
|
||||
static bool filetype_msg_proc(Widget* widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_SIGNAL) {
|
||||
ComboBox* combobox = dynamic_cast<ComboBox*>(widget);
|
||||
@ -681,7 +681,7 @@ static bool filetype_msg_proc(JWidget widget, JMessage msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool filename_msg_proc(JWidget widget, JMessage msg)
|
||||
static bool filename_msg_proc(Widget* widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_KEYRELEASED && msg->key.ascii >= 32) {
|
||||
// Check if all keys are released
|
||||
|
@ -1401,12 +1401,6 @@ bool Widget::hasCapture()
|
||||
/**********************************************************************/
|
||||
/* miscellaneous */
|
||||
|
||||
JWidget jwidget_find_name(JWidget widget, const char *name)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
return widget->findChild(name);
|
||||
}
|
||||
|
||||
bool jwidget_check_underscored(JWidget widget, int scancode)
|
||||
{
|
||||
int c, ascii;
|
||||
|
@ -88,7 +88,6 @@ bool jwidget_emit_signal(JWidget widget, int signal_num);
|
||||
|
||||
/* miscellaneous */
|
||||
|
||||
JWidget jwidget_find_name(JWidget widget, const char *name);
|
||||
bool jwidget_check_underscored(JWidget widget, int scancode);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -705,7 +705,7 @@ Widget* load_widget(const char* filename, const char* name)
|
||||
|
||||
JWidget find_widget(JWidget widget, const char *name)
|
||||
{
|
||||
JWidget child = jwidget_find_name(widget, name);
|
||||
Widget* child = widget->findChild(name);
|
||||
if (!child)
|
||||
throw widget_not_found(name);
|
||||
|
||||
@ -802,7 +802,7 @@ void get_widgets(JWidget window, ...)
|
||||
if (!widget)
|
||||
break;
|
||||
|
||||
*widget = jwidget_find_name(window, name);
|
||||
*widget = window->findChild(name);
|
||||
if (!*widget)
|
||||
throw widget_not_found(name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user