mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Added SkinneableTheme::reload_skin() to reload the skin sheet.png file when you press F5.
This commit is contained in:
parent
e555f78996
commit
2c49990420
@ -25,10 +25,12 @@
|
|||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "jinete/jtheme.h"
|
||||||
#include "jinete/jsystem.h"
|
#include "jinete/jsystem.h"
|
||||||
|
|
||||||
#include "commands/command.h"
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "commands/command.h"
|
||||||
|
#include "modules/skinneable_theme.h"
|
||||||
#include "widgets/statebar.h"
|
#include "widgets/statebar.h"
|
||||||
#include "sprite_wrappers.h"
|
#include "sprite_wrappers.h"
|
||||||
|
|
||||||
@ -58,12 +60,19 @@ void RefreshCommand::execute(Context* context)
|
|||||||
clear_to_color(screen, makecol(0, 0, 0));
|
clear_to_color(screen, makecol(0, 0, 0));
|
||||||
jmouse_show();
|
jmouse_show();
|
||||||
|
|
||||||
|
// Reload skin
|
||||||
|
{
|
||||||
|
SkinneableTheme* theme = (SkinneableTheme*)ji_get_theme();
|
||||||
|
theme->reload_skin();
|
||||||
|
ji_regen_theme();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const CurrentSpriteReader sprite(context);
|
const CurrentSpriteReader sprite(context);
|
||||||
app_refresh_screen(sprite);
|
app_refresh_screen(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print memory information */
|
// Print memory information
|
||||||
#if defined ALLEGRO_WINDOWS && defined DEBUGMODE
|
#if defined ALLEGRO_WINDOWS && defined DEBUGMODE
|
||||||
{
|
{
|
||||||
PROCESS_MEMORY_COUNTERS pmc;
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
|
@ -133,6 +133,34 @@ SkinneableTheme::SkinneableTheme()
|
|||||||
sheet_mapping["colorbar_border_fg"] = PART_COLORBAR_BORDER_FG_NW;
|
sheet_mapping["colorbar_border_fg"] = PART_COLORBAR_BORDER_FG_NW;
|
||||||
sheet_mapping["colorbar_border_bg"] = PART_COLORBAR_BORDER_BG_NW;
|
sheet_mapping["colorbar_border_bg"] = PART_COLORBAR_BORDER_BG_NW;
|
||||||
|
|
||||||
|
reload_skin();
|
||||||
|
}
|
||||||
|
|
||||||
|
SkinneableTheme::~SkinneableTheme()
|
||||||
|
{
|
||||||
|
for (int c=0; c<JI_CURSORS; ++c)
|
||||||
|
if (m_cursors[c])
|
||||||
|
destroy_bitmap(m_cursors[c]);
|
||||||
|
|
||||||
|
for (int c=0; c<PARTS; ++c)
|
||||||
|
destroy_bitmap(m_part[c]);
|
||||||
|
|
||||||
|
for (std::map<std::string, BITMAP*>::iterator
|
||||||
|
it = m_toolicon.begin(); it != m_toolicon.end(); ++it) {
|
||||||
|
destroy_bitmap(it->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy_bitmap(m_sheet_bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call ji_regen_theme after this
|
||||||
|
void SkinneableTheme::reload_skin()
|
||||||
|
{
|
||||||
|
if (m_sheet_bmp) {
|
||||||
|
destroy_bitmap(m_sheet_bmp);
|
||||||
|
m_sheet_bmp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Load the skin sheet
|
// Load the skin sheet
|
||||||
std::string sheet_filename = ("skins/" + m_selected_skin + "/sheet.png");
|
std::string sheet_filename = ("skins/" + m_selected_skin + "/sheet.png");
|
||||||
{
|
{
|
||||||
@ -155,23 +183,6 @@ SkinneableTheme::SkinneableTheme()
|
|||||||
throw ase_exception("Error loading %s file", sheet_filename.c_str());
|
throw ase_exception("Error loading %s file", sheet_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
SkinneableTheme::~SkinneableTheme()
|
|
||||||
{
|
|
||||||
for (int c=0; c<JI_CURSORS; ++c)
|
|
||||||
if (m_cursors[c])
|
|
||||||
destroy_bitmap(m_cursors[c]);
|
|
||||||
|
|
||||||
for (int c=0; c<PARTS; ++c)
|
|
||||||
destroy_bitmap(m_part[c]);
|
|
||||||
|
|
||||||
for (std::map<std::string, BITMAP*>::iterator
|
|
||||||
it = m_toolicon.begin(); it != m_toolicon.end(); ++it) {
|
|
||||||
destroy_bitmap(it->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy_bitmap(m_sheet_bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string SkinneableTheme::get_font_filename() const
|
std::string SkinneableTheme::get_font_filename() const
|
||||||
{
|
{
|
||||||
return "skins/" + m_selected_skin + "/font.pcx";
|
return "skins/" + m_selected_skin + "/font.pcx";
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#include "jinete/jtheme.h"
|
#include "jinete/jtheme.h"
|
||||||
#include "jinete/jrect.h"
|
#include "jinete/jrect.h"
|
||||||
#include "Vaca/Property.h"
|
#include "Vaca/Property.h"
|
||||||
|
#include "Vaca/Rect.h"
|
||||||
|
|
||||||
|
using Vaca::Rect;
|
||||||
|
|
||||||
class SkinProperty : public Vaca::Property
|
class SkinProperty : public Vaca::Property
|
||||||
{
|
{
|
||||||
@ -420,6 +423,8 @@ public:
|
|||||||
SkinneableTheme();
|
SkinneableTheme();
|
||||||
~SkinneableTheme();
|
~SkinneableTheme();
|
||||||
|
|
||||||
|
void reload_skin();
|
||||||
|
|
||||||
std::string get_font_filename() const;
|
std::string get_font_filename() const;
|
||||||
|
|
||||||
void regen();
|
void regen();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user