Use 16x16 icons for dialogs rather than cropping the 24x24 icons to 16x16

Originally committed to SVN as r6650.
This commit is contained in:
Thomas Goyne 2012-04-03 20:40:24 +00:00
parent a679d91304
commit fe36760872
19 changed files with 29 additions and 53 deletions

View File

@ -67,7 +67,7 @@ DialogAttachments::DialogAttachments(wxWindow *parent, AssFile *ass)
: wxDialog(parent,-1,_("Attachment List"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE)
, ass(ass)
{
SetIcon(BitmapToIcon(GETIMAGE(attach_button_24)));
SetIcon(GETICON(attach_button_16));
listView = new wxListView(this,ATTACHMENT_LIST,wxDefaultPosition,wxSize(500,200));
UpdateList();

View File

@ -56,7 +56,6 @@
#include "libresrc/libresrc.h"
#include "main.h"
#include "subtitle_format.h"
#include "utils.h"
using std::tr1::placeholders::_1;
@ -68,7 +67,7 @@ DialogAutomation::DialogAutomation(agi::Context *c)
, global_manager(wxGetApp().global_scripts)
, global_scripts_changed(global_manager->AddScriptChangeListener(&DialogAutomation::RebuildList, this))
{
SetIcon(BitmapToIcon(GETIMAGE(automation_toolbutton_24)));
SetIcon(GETICON(automation_toolbutton_16));
// create main controls
list = new wxListView(this, -1, wxDefaultPosition, wxSize(600, 175), wxLC_REPORT|wxLC_SINGLE_SEL);

View File

@ -184,7 +184,7 @@ DialogFontsCollector::DialogFontsCollector(agi::Context *c)
: wxDialog(c->parent, -1, _("Fonts Collector"))
, subs(c->ass)
{
SetIcon(BitmapToIcon(GETIMAGE(font_collector_button_24)));
SetIcon(GETICON(font_collector_button_16));
wxString modes[] = {
_("Check fonts for availability"),

View File

@ -50,7 +50,6 @@
#include "ass_time.h"
#include "libresrc/libresrc.h"
#include "timeedit_ctrl.h"
#include "utils.h"
#include "validators.h"
#include "video_context.h"
@ -59,7 +58,7 @@ DialogJumpTo::DialogJumpTo(agi::Context *c)
, c(c)
, jumpframe(c->videoController->GetFrameN())
{
SetIcon(BitmapToIcon(GETIMAGE(jumpto_button_24)));
SetIcon(GETICON(jumpto_button_16));
// Set initial values
wxString maxLength = wxString::Format("%i",c->videoController->GetLength() - 1);

View File

@ -633,7 +633,7 @@ bool KaraokeLineMatchDisplay::UndoMatch()
DialogKanjiTimer::DialogKanjiTimer(agi::Context *c)
: wxDialog(c->parent,-1,_("Kanji timing"),wxDefaultPosition)
{
SetIcon(BitmapToIcon(GETIMAGE(kara_timing_copier_24)));
SetIcon(GETICON(kara_timing_copier_16));
subs = c->ass;
currentSourceLine = subs->Line.begin();

View File

@ -51,7 +51,6 @@
#include "help_button.h"
#include "include/aegisub/context.h"
#include "libresrc/libresrc.h"
#include "utils.h"
#include "validators.h"
#include "video_context.h"
@ -59,7 +58,7 @@ DialogProperties::DialogProperties(agi::Context *c)
: wxDialog(c->parent, -1, _("Script Properties"))
, c(c)
{
SetIcon(BitmapToIcon(GETIMAGE(properties_toolbutton_24)));
SetIcon(GETICON(properties_toolbutton_16));
// Script details crap
wxSizer *TopSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Script"));

View File

@ -42,7 +42,6 @@
#include "include/aegisub/context.h"
#include "help_button.h"
#include "libresrc/libresrc.h"
#include "utils.h"
#include "video_context.h"
enum {
@ -56,7 +55,7 @@ DialogResample::DialogResample(agi::Context *c, ResampleSettings &settings)
: wxDialog(c->parent, -1, _("Resample Resolution"))
, c(c)
{
SetIcon(BitmapToIcon(GETIMAGE(resample_toolbutton_24)));
SetIcon(GETICON(resample_toolbutton_16));
memset(&settings, 0, sizeof(settings));
c->ass->GetResolution(settings.script_x, settings.script_y);

View File

@ -55,7 +55,6 @@
#include "main.h"
#include "standard_paths.h"
#include "timeedit_ctrl.h"
#include "utils.h"
#include "video_context.h"
static wxString get_history_string(json::Object &obj) {
@ -107,7 +106,7 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context)
, history(new json::Array)
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
{
SetIcon(BitmapToIcon(GETIMAGE(shift_times_toolbutton_24)));
SetIcon(GETICON(shift_times_toolbutton_16));
// Create controls
shift_by_time = new wxRadioButton(this, -1, _("&Time: "), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);

View File

@ -60,7 +60,7 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context)
, active_line(0)
, has_looped(false)
{
SetIcon(BitmapToIcon(GETIMAGE(spellcheck_toolbutton_24)));
SetIcon(GETICON(spellcheck_toolbutton_16));
wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);

View File

@ -164,7 +164,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
work.reset(new AssStyle(*style));
SetIcon(BitmapToIcon(GETIMAGE(style_toolbutton_24)));
SetIcon(GETICON(style_toolbutton_16));
// Prepare control values
wxString EncodingValue = AegiIntegerToString(style->encoding);

View File

@ -64,7 +64,6 @@
#include "persist_location.h"
#include "selection_controller.h"
#include "standard_paths.h"
#include "utils.h"
using std::tr1::placeholders::_1;
@ -168,7 +167,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context)
, commit_connection(c->ass->AddCommitListener(&DialogStyleManager::LoadCurrentStyles, this))
{
using std::tr1::bind;
SetIcon(BitmapToIcon(GETIMAGE(style_toolbutton_24)));
SetIcon(GETICON(style_toolbutton_16));
// Catalog
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages"));

View File

@ -37,7 +37,6 @@
#include "help_button.h"
#include "libresrc/libresrc.h"
#include "persist_location.h"
#include "utils.h"
#include "video_context.h"
#ifndef AGI_PRE
@ -60,7 +59,7 @@ DialogStyling::DialogStyling(agi::Context *context)
, c(context)
, active_line(0)
{
SetIcon(BitmapToIcon(GETIMAGE(styling_toolbutton_24)));
SetIcon(GETICON(styling_toolbutton_16));
wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
wxSizer *bottom_sizer = new wxBoxSizer(wxHORIZONTAL);

View File

@ -107,7 +107,7 @@ DialogTimingProcessor::DialogTimingProcessor(agi::Context *c)
{
using std::tr1::bind;
SetIcon(BitmapToIcon(GETIMAGE(timing_processor_toolbutton_24)));
SetIcon(GETICON(timing_processor_toolbutton_16));
// Read options
leadIn = OPT_GET("Audio/Lead/IN")->GetInt();

View File

@ -73,7 +73,7 @@ DialogTranslation::DialogTranslation(agi::Context *c)
, line_number(count_if(c->ass->Line.begin(), find(c->ass->Line.begin(), c->ass->Line.end(), active_line), cast<AssDialogue*>()) + 1)
, switching_lines(false)
{
SetIcon(BitmapToIcon(GETIMAGE(translation_toolbutton_16)));
SetIcon(GETICON(translation_toolbutton_16));
wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);

View File

@ -2,11 +2,17 @@
wxBitmap libresrc_getimage(const unsigned char *buff, size_t size) {
wxMemoryInputStream mem(buff, size);
wxImage image(mem);
return wxBitmap(image);
return wxBitmap(wxImage(mem));
}
wxIcon libresrc_geticon(const unsigned char *buff, size_t size) {
wxMemoryInputStream mem(buff, size);
wxIcon icon;
icon.CopyFromBitmap(wxBitmap(wxImage(mem)));
return icon;
}
const std::string libresrc_getconfig(const unsigned char *config, size_t size) {
std::string str((char*)config, size);
return str.c_str();
std::string str((char*)config, size);
return str.c_str();
}

View File

@ -1,14 +1,17 @@
#include <string>
#include <wx/mstream.h>
#include <wx/bitmap.h>
#include <wx/icon.h>
#include <wx/image.h>
#include <wx/mstream.h>
#include "bitmap.h"
#include "default_config.h"
wxBitmap libresrc_getimage(const unsigned char *image, size_t size);
wxIcon libresrc_geticon(const unsigned char *image, size_t size);
#define GETIMAGE(a) libresrc_getimage(a, sizeof(a))
#define GETICON(a) libresrc_geticon(a, sizeof(a))
const std::string libresrc_getconfig(const unsigned char *config, size_t size);
#define GET_DEFAULT_CONFIG(a) libresrc_getconfig(a, sizeof(a))

View File

@ -658,7 +658,7 @@ static void PageChanged(wxBookCtrlEvent& evt) {
}
Preferences::Preferences(wxWindow *parent): wxDialog(parent, -1, _("Preferences"), wxDefaultPosition, wxSize(-1, 500)) {
// SetIcon(BitmapToIcon(GETIMAGE(options_button_24)));
// SetIcon(GETICON(options_button_16));
book = new wxTreebook(this, -1, wxDefaultPosition, wxDefaultSize);
new General(book, this);

View File

@ -271,27 +271,6 @@ int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start,int end)
return (major + minor)*sign;
}
wxIcon BitmapToIcon(wxBitmap const& iconBmp) {
// Create the icon and background bmp
wxIcon ico;
wxBitmap bmp(16,16);
// Blit bitmap into 16x16 one (don't remove brackets)
{
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(wxColour(192,192,192));
dc.Clear();
dc.DrawBitmap(iconBmp,0,0,false);
}
// Create mask and convert to icon
wxMask *mask = new wxMask(bmp,wxColour(192,192,192));
bmp.SetMask(mask);
ico.CopyFromBitmap(bmp);
return ico;
}
void RestartAegisub() {
#if defined(__WXMSW__)
wxStandardPaths stand;

View File

@ -88,11 +88,6 @@ bool StringEmptyOrWhitespace(const wxString &str);
int AegiStringToInt(const wxString &str,int start=0,int end=-1);
int AegiStringToFix(const wxString &str,size_t decimalPlaces,int start=0,int end=-1);
/// @brief Convert a wxBitmap to wxIcon
///
/// This is needed because wxIcon has to be 16x16 to work properly on win32
wxIcon BitmapToIcon(wxBitmap const& bmp);
/// @brief Launch a new copy of Aegisub.
///
/// Contrary to what the name suggests, this does not close the currently