Skip to content

Commit

Permalink
ADD: loading gui themes on runtime
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@6702 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
prissi committed Sep 12, 2013
1 parent 3973708 commit 6faf369
Show file tree
Hide file tree
Showing 87 changed files with 860 additions and 1,024 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ SOURCES += gui/goods_frame_t.cc
SOURCES += gui/goods_stats_t.cc
SOURCES += gui/ground_info.cc
SOURCES += gui/gui_frame.cc
SOURCES += gui/gui_theme.cc
SOURCES += gui/halt_detail.cc
SOURCES += gui/halt_info.cc
SOURCES += gui/halt_list_filter_frame.cc
Expand Down
4 changes: 4 additions & 0 deletions Simutrans.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
<ClCompile Include="gui\components\gui_image.cc" />
<ClCompile Include="gui\components\gui_komponente.cc" />
<ClCompile Include="gui\components\gui_map_preview.cc" />
<ClCompile Include="gui\gui_theme.cc" />
<ClCompile Include="gui\simwin.cc" />
<ClCompile Include="gui\themeselector.cc" />
<ClCompile Include="player\ai.cc" />
<ClCompile Include="player\ai_goods.cc" />
<ClCompile Include="gui\ai_option_t.cc" />
Expand Down Expand Up @@ -424,7 +426,9 @@
<ClInclude Include="gui\components\action_listener.h" />
<ClInclude Include="gui\components\gui_container.h" />
<ClInclude Include="gui\components\gui_convoiinfo.h" />
<ClInclude Include="gui\gui_theme.h" />
<ClInclude Include="gui\simwin.h" />
<ClInclude Include="gui\themeselector.h" />
<ClInclude Include="player\ai.h" />
<ClInclude Include="player\ai_goods.h" />
<ClInclude Include="gui\ai_option_t.h" />
Expand Down
19 changes: 0 additions & 19 deletions besch/reader/obj_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@ void obj_reader_t::register_reader()
}


bool obj_reader_t::init()
{
#if THEME != -1
// search for skins first
chdir( umgebung_t::program_dir );
load( "skin/", translator::translate("Loading skins ...") );
if( umgebung_t::program_dir != umgebung_t::user_dir ) {
chdir( umgebung_t::user_dir );
load( "skin/", translator::translate("Loading skins ...") );
}
#endif
chdir( umgebung_t::program_dir );
button_t::init_button_images();
return true;
}


bool obj_reader_t::laden_abschliessen()
{
resolve_xrefs();
Expand All @@ -77,8 +60,6 @@ bool obj_reader_t::laden_abschliessen()
return false;
}
}

button_t::init_button_images();
return true;
}

Expand Down
5 changes: 3 additions & 2 deletions besch/reader/obj_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class obj_reader_t
static unresolved_map unresolved;
static ptrhashtable_tpl<obj_besch_t **, int> fatals;

static void read_file(const char *name);
static void read_nodes(FILE* fp, obj_besch_t*& data, int register_nodes,uint32 version);
static void skip_nodes(FILE *fp,uint32 version);

Expand Down Expand Up @@ -107,14 +106,16 @@ class obj_reader_t
virtual obj_type get_type() const = 0;
virtual const char *get_type_name() const = 0;

static bool init();
static bool laden_abschliessen();
/**
* Loads all pak files from a directory, displaying a progress bar if the display is initialized
* @param path Directory to be scanned for PAK files
* @param message Label to show over the progress bar
*/
static bool load(const char *path, const char *message);

// Only for single files, must take care ob all the cleanup/registering matrix themeselves
static void read_file(const char *name);
};

#endif
18 changes: 9 additions & 9 deletions gui/banner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ banner_t::banner_t( karte_t *w) : gui_frame_t(""),
quit.init( button_t::roundbox, "Beenden", cursor );
quit.add_listener( this );
add_komponente( &quit );
cursor += button_t::gui_button_size;
cursor += gui_theme_t::gui_button_size;

set_fenstergroesse( koord( L_DIALOG_WIDTH, D_TITLEBAR_HEIGHT + cursor.y + D_MARGIN_BOTTOM ) );
}
Expand Down Expand Up @@ -147,22 +147,22 @@ void banner_t::zeichnen(koord pos, koord gr )
cursor.y += L_LINESPACE_EXTRA_5;

#ifdef REVISION
display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "Version " VERSION_NUMBER " " VERSION_DATE " r" QUOTEME(REVISION), true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "Version " VERSION_NUMBER " " VERSION_DATE " r" QUOTEME(REVISION), true );
#else
display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "Version " VERSION_NUMBER " " VERSION_DATE, true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "Version " VERSION_NUMBER " " VERSION_DATE, true );
#endif
cursor.y += L_LINESPACE_EXTRA_7;

display_shadow_proportional( cursor.x, cursor.y, COL_PT, COL_BLACK, "The version is developed by", true );
cursor += koord (L_TEXT_INDENT,L_LINESPACE_EXTRA_5);

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "the simutrans team", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "the simutrans team", true );
cursor.y += L_LINESPACE_EXTRA_2;

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "under the Artistic Licence", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "under the Artistic Licence", true );
cursor.y += L_LINESPACE_EXTRA_2;

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "based on Simutrans 84.22.1", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "based on Simutrans 84.22.1", true );
cursor += koord (-L_TEXT_INDENT,L_LINESPACE_EXTRA_7);

display_shadow_proportional( cursor.x, cursor.y, COL_ORANGE, COL_BLACK, "Selling of the program is forbidden.", true );
Expand All @@ -171,13 +171,13 @@ void banner_t::zeichnen(koord pos, koord gr )
display_shadow_proportional( cursor.x, cursor.y, COL_PT, COL_BLACK, "For questions and support please visit:", true );
cursor += koord (L_TEXT_INDENT,L_LINESPACE_EXTRA_2);

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "http://www.simutrans.com", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "http://www.simutrans.com", true );
cursor.y += L_LINESPACE_EXTRA_2;

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "http://forum.simutrans.com", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "http://forum.simutrans.com", true );
cursor.y += L_LINESPACE_EXTRA_2;

display_shadow_proportional( cursor.x, cursor.y, COL_WHITE, COL_BLACK, "http://wiki.simutrans-germany.com/", true );
display_shadow_proportional( cursor.x, cursor.y, SYSCOL_TEXT_HIGHLITE, COL_BLACK, "http://wiki.simutrans-germany.com/", true );
cursor.y += L_LINESPACE_EXTRA_7;

// now the scrolling
Expand Down
2 changes: 1 addition & 1 deletion gui/citybuilding_edit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static bool compare_haus_besch(const haus_besch_t* a, const haus_besch_t* b)
citybuilding_edit_frame_t::citybuilding_edit_frame_t(spieler_t* sp_, karte_t* welt) :
extend_edit_gui_t(translator::translate("citybuilding builder"), sp_, welt),
hauslist(16),
lb_rotation( rot_str, COL_WHITE, gui_label_t::right ),
lb_rotation( rot_str, SYSCOL_TEXT_HIGHLITE, gui_label_t::right ),
lb_rotation_info( translator::translate("Rotation"), COL_BLACK, gui_label_t::left )
{
rot_str[0] = 0;
Expand Down
2 changes: 1 addition & 1 deletion gui/citylist_stats_t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void citylist_stats_t::zeichnen(koord offset)
display_proportional_clip(offset.x + 4 + 10, offset.y, buf, ALIGN_LEFT, COL_BLACK, true);

// goto button
image_id const img = sel-- != 0 ? button_t::arrow_right_normal : button_t::arrow_right_pushed;
image_id const img = sel-- != 0 ? button_t::pos_button_normal : button_t::pos_button_pushed;
display_color_img(img, offset.x + 2, offset.y, 0, false, true);

if( win_get_magic( (ptrdiff_t)stadt ) ) {
Expand Down
6 changes: 3 additions & 3 deletions gui/climates.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
climate_gui_t::climate_gui_t(settings_t* const sets_par) :
gui_frame_t( translator::translate("Climate Control") )
{
const scr_coord_val edit_width = display_get_char_max_width("-0123456789")*4 + button_t::gui_arrow_left_size.x + button_t::gui_arrow_right_size.x + 4;
const scr_coord_val edit_width = display_get_char_max_width("-0123456789")*4 + gui_theme_t::gui_arrow_left_size.x + gui_theme_t::gui_arrow_right_size.x + 4;
const scr_coord_val label_width = L_COLUMN_EDIT - D_MARGIN_LEFT-D_H_SPACE;
koord cursor(D_MARGIN_LEFT,D_MARGIN_TOP);
sint16 labelnr=0;
Expand Down Expand Up @@ -90,8 +90,8 @@ climate_gui_t::climate_gui_t(settings_t* const sets_par) :
add_komponente( numberinput_lbl+labelnr );
labelnr++;
sprintf( snowline_txt ,"%d", sets->get_climate_borders()[arctic_climate] );
summer_snowline.init( snowline_txt, cursor, COL_WHITE);
summer_snowline.align_to(&mountain_roughness,ALIGN_RIGHT,koord(button_t::gui_arrow_right_size.x,0));
summer_snowline.init( snowline_txt, cursor, SYSCOL_TEXT_HIGHLITE);
summer_snowline.align_to(&mountain_roughness,ALIGN_RIGHT,koord(gui_theme_t::gui_arrow_right_size.x,0));
add_komponente( &summer_snowline );
cursor.y += LINESPACE+D_V_SPACE;

Expand Down
Loading

0 comments on commit 6faf369

Please sign in to comment.