mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-25 07:40:54 +02:00
Update to 20180731 release.
byuu says: I've completed moving all the class objects from `unique_pointer<T>` to just T. The one exception is the Emulator::Interface instance. I can absolutely make that a global object, but only in bsnes where there's just the one emulation core. I also moved all the SettingsWindow and ToolsWindow panels out to their own global objects, and fixed a very difficult bug with GTK TabFrame controls. The configuration settings panel is now the emulator settings panel. And I added some spacing between bold label sections on both the emulator and driver settings panels. I gave fixing ComboButtonItem my best shot, given I can't reproduce the crash. Probably won't work, though. Also made a very slight consistency improvement to ruby and renamed driverName() to driver(). ... An important change ... as a result of moving bsnes to global objects, this means that the constructors for all windows run before the presentation window is displayed. Before this change, only the presentation window was constructed first berore displaying it, followed by the construction of the rest of the GUI windows. The upside to this is that as soon as you see the main window, the GUI is ready to go without a period where it's unresponsive. The downside to this is it takes about 1.5 seconds to show the main window, compared to around 0.75 seconds before. I've no intention of changing that back. So if the startup time becomes a problem, then we'll just have to work on optimizing hiro, so that it can construct all the global Window objects quicker. The main way to do that would be to not do calls to the Layout::setGeometry functions for every widget added, and instead wait until the window is displayed. But I don't have an easy way to do that, because you want the widget geometry values to be sane even before the window is visible to help size certain things.
This commit is contained in:
@@ -27,9 +27,6 @@ auto pObject::setFocused() -> void {
|
||||
auto pObject::setFont(const Font& font) -> void {
|
||||
}
|
||||
|
||||
auto pObject::setParent(mObject* parent, int offset) -> void {
|
||||
}
|
||||
|
||||
auto pObject::setVisible(bool visible) -> void {
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,6 @@ struct pObject : mLock {
|
||||
virtual auto setEnabled(bool enabled) -> void;
|
||||
virtual auto setFocused() -> void;
|
||||
virtual auto setFont(const Font& font) -> void;
|
||||
virtual auto setParent(mObject* parent, int offset) -> void;
|
||||
virtual auto setVisible(bool visible) -> void;
|
||||
|
||||
mObject& reference;
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace hiro {
|
||||
|
||||
auto pTabFrameItem::construct() -> void {
|
||||
if(auto parent = _parent()) parent->_append();
|
||||
if(auto& sizable = state().sizable) sizable->construct();
|
||||
}
|
||||
|
||||
|
@@ -63,36 +63,6 @@ auto pTabFrame::destruct() -> void {
|
||||
|
||||
auto pTabFrame::append(sTabFrameItem item) -> void {
|
||||
lock();
|
||||
Tab tab;
|
||||
tab.child = gtk_fixed_new();
|
||||
#if HIRO_GTK==2
|
||||
tab.container = gtk_hbox_new(false, 0);
|
||||
#elif HIRO_GTK==3
|
||||
tab.container = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
#endif
|
||||
tab.image = gtk_image_new();
|
||||
tab.title = gtk_label_new("");
|
||||
gtk_misc_set_alignment(GTK_MISC(tab.title), 0.0, 0.5);
|
||||
tab.close = gtk_button_new_with_label("\u00d7"); //Unicode multiplication sign (looks better than 'X')
|
||||
gtk_button_set_focus_on_click(GTK_BUTTON(tab.close), false);
|
||||
gtk_button_set_relief(GTK_BUTTON(tab.close), GTK_RELIEF_NONE);
|
||||
pFont::setFont(tab.close, Font("sans", 9).setBold());
|
||||
auto color = CreateColor({255, 0, 0});
|
||||
gtk_widget_modify_fg(gtk_bin_get_child(GTK_BIN(tab.close)), GTK_STATE_PRELIGHT, &color);
|
||||
tabs.append(tab);
|
||||
|
||||
gtk_widget_show(tab.child);
|
||||
gtk_widget_show(tab.container);
|
||||
gtk_widget_show(tab.image);
|
||||
gtk_widget_show(tab.title);
|
||||
gtk_widget_show(tab.close);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.image, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.title, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.close, false, false, 0);
|
||||
|
||||
g_signal_connect(G_OBJECT(tab.close), "clicked", G_CALLBACK(TabFrame_close), (gpointer)this);
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(gtkWidget), tab.child, tab.container);
|
||||
|
||||
setFont(self().font(true));
|
||||
setItemMovable(item->offset(), item->movable());
|
||||
if(item->selected()) setItemSelected(item->offset());
|
||||
@@ -210,6 +180,42 @@ auto pTabFrame::setNavigation(Navigation navigation) -> void {
|
||||
setGeometry(self().geometry());
|
||||
}
|
||||
|
||||
//called by pTabFrameItem::construct(), before pTabFrame::append()
|
||||
//tab needs to be created early, so that pTabFrameItem child widgets calling pWidget::container() can find the tab
|
||||
auto pTabFrame::_append() -> void {
|
||||
lock();
|
||||
Tab tab;
|
||||
tab.child = gtk_fixed_new();
|
||||
#if HIRO_GTK==2
|
||||
tab.container = gtk_hbox_new(false, 0);
|
||||
#elif HIRO_GTK==3
|
||||
tab.container = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
#endif
|
||||
tab.image = gtk_image_new();
|
||||
tab.title = gtk_label_new("");
|
||||
gtk_misc_set_alignment(GTK_MISC(tab.title), 0.0, 0.5);
|
||||
tab.close = gtk_button_new_with_label("\u00d7"); //Unicode multiplication sign (looks better than 'X')
|
||||
gtk_button_set_focus_on_click(GTK_BUTTON(tab.close), false);
|
||||
gtk_button_set_relief(GTK_BUTTON(tab.close), GTK_RELIEF_NONE);
|
||||
pFont::setFont(tab.close, Font("sans", 9).setBold());
|
||||
auto color = CreateColor({255, 0, 0});
|
||||
gtk_widget_modify_fg(gtk_bin_get_child(GTK_BIN(tab.close)), GTK_STATE_PRELIGHT, &color);
|
||||
tabs.append(tab);
|
||||
|
||||
gtk_widget_show(tab.child);
|
||||
gtk_widget_show(tab.container);
|
||||
gtk_widget_show(tab.image);
|
||||
gtk_widget_show(tab.title);
|
||||
gtk_widget_show(tab.close);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.image, false, false, 0);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.title, true, true, 0);
|
||||
gtk_box_pack_start(GTK_BOX(tab.container), tab.close, false, false, 0);
|
||||
|
||||
g_signal_connect(G_OBJECT(tab.close), "clicked", G_CALLBACK(TabFrame_close), (gpointer)this);
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(gtkWidget), tab.child, tab.container);
|
||||
unlock();
|
||||
}
|
||||
|
||||
auto pTabFrame::_synchronizeLayout() -> void {
|
||||
for(auto& item : state().items) {
|
||||
if(auto& sizable = item->state.sizable) {
|
||||
|
@@ -18,6 +18,7 @@ struct pTabFrame : pWidget {
|
||||
auto setItemText(unsigned position, const string& text) -> void;
|
||||
auto setNavigation(Navigation navigation) -> void;
|
||||
|
||||
auto _append() -> void;
|
||||
auto _synchronizeLayout() -> void;
|
||||
auto _synchronizeTab(unsigned position) -> void;
|
||||
auto _tabHeight() -> unsigned;
|
||||
|
Reference in New Issue
Block a user