diff myframe.cpp @ 3:cc1f1fa544a4

for wxWidgets 3.1
author pyon@macmini
date Sun, 27 Nov 2016 20:15:37 +0900
parents 25a76c128804
children 3fadcf124bb4
line wrap: on
line diff
--- a/myframe.cpp	Mon Feb 03 18:51:33 2014 +0900
+++ b/myframe.cpp	Sun Nov 27 20:15:37 2016 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 03-Feb-2014.
+// Last Change: 2016-11-27 Sun 20:08:02.
 //
 
 #include "myframe.h"
@@ -10,38 +10,38 @@
     : wxFrame( parent, id, title, pos, size, style )
 {
     this->SetIcon( wxIcon( wxT("sample") ) );
-	this->SetSizeHints( wxSize( 450, 200 ), wxSize( 450, 200 ) );
-	this->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
-	this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
+	//this->SetSizeHints( wxSize( 450, 200 ), wxSize( 450, 200 ) );
+	this->SetSizeHints( wxSize( 550, 200 ), wxSize( 550, 200 ) );
+	this->SetBackgroundColour( *wxBLACK );
 	
 	wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
 	
     // Source
 	wxBoxSizer* bSizerSource = new wxBoxSizer( wxHORIZONTAL );
 	
-	m_staticTextSource = new wxStaticText( this, wxID_ANY, wxT("Source"), wxDefaultPosition, wxSize( 90,-1 ), wxALIGN_RIGHT );
+	m_staticTextSource = new wxStaticText( this, wxID_ANY, wxT("Source"), wxDefaultPosition, wxSize( 90, -1 ), wxALIGN_RIGHT );
 	m_staticTextSource->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextSource->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_staticTextSource->SetBackgroundColour( *wxBLACK );
 	
 	bSizerSource->Add( m_staticTextSource, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_textCtrlSource = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), wxTAB_TRAVERSAL );
+	m_textCtrlSource = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200, -1 ), wxTAB_TRAVERSAL );
 	bSizerSource->Add( m_textCtrlSource, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	bSizerTop->Add( bSizerSource, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
+	bSizerTop->Add( bSizerSource, 1, wxEXPAND, 5 );
 	
     // Config
     // Type
 	wxBoxSizer* bSizerConfig = new wxBoxSizer( wxHORIZONTAL );
 	
-	m_staticTextConfig = new wxStaticText( this, wxID_ANY, wxT("Config"), wxDefaultPosition, wxSize( 90,-1 ), wxALIGN_RIGHT );
+	m_staticTextConfig = new wxStaticText( this, wxID_ANY, wxT("Config"), wxDefaultPosition, wxSize( 90, -1 ), wxALIGN_RIGHT );
 	m_staticTextConfig->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextConfig->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_staticTextConfig->SetBackgroundColour( *wxBLACK );
 	bSizerConfig->Add( m_staticTextConfig, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 
 	m_staticTextType = new wxStaticText( this, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
 	m_staticTextType->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextType->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_staticTextType->SetBackgroundColour( *wxBLACK );
 	bSizerConfig->Add( m_staticTextType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_comboBoxType = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY|wxTAB_TRAVERSAL );
@@ -53,27 +53,29 @@
 	m_comboBoxType->Append( wxT("BMP")  );
 	m_comboBoxType->Append( wxT("TIFF") );
 	m_comboBoxType->Append( wxT("JPEG") );
+	m_comboBoxType->Append( wxT("SVG")  );
 	m_comboBoxType->SetSelection( 0 );
 	bSizerConfig->Add( m_comboBoxType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
     // Size
 	m_staticTextSize = new wxStaticText( this, wxID_ANY, wxT("Size"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
 	m_staticTextSize->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextSize->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_staticTextSize->SetBackgroundColour( *wxBLACK );
 	bSizerConfig->Add( m_staticTextSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_staticTextWidth = new wxStaticText( this, wxID_ANY, wxT("Width"), wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
 	m_staticTextWidth->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextWidth->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
-	bSizerConfig->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
+	m_staticTextWidth->SetBackgroundColour( *wxBLACK );
+	bSizerConfig->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 	
 	m_textCtrlWidth = new wxTextCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxSize( 40, -1 ), wxTE_CENTRE );
+	m_staticTextWidth->SetBackgroundColour( *wxBLACK );
 	bSizerConfig->Add( m_textCtrlWidth, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_staticTextHeight = new wxStaticText( this, wxID_ANY, wxT("Height"), wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
 	m_staticTextHeight->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextHeight->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
-	bSizerConfig->Add( m_staticTextHeight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
+	m_staticTextHeight->SetBackgroundColour( *wxBLACK );
+	bSizerConfig->Add( m_staticTextHeight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 	
 	m_textCtrlHeight = new wxTextCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxSize( 50, -1 ), wxTE_CENTRE );
 	bSizerConfig->Add( m_textCtrlHeight, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -83,13 +85,14 @@
     // Output
 	wxBoxSizer* bSizerOutput = new wxBoxSizer( wxHORIZONTAL );
 	
-	m_staticTextOutput = new wxStaticText( this, wxID_ANY, wxT("Output folder"), wxDefaultPosition, wxSize( 90,-1 ), wxALIGN_RIGHT );
+	m_staticTextOutput = new wxStaticText( this, wxID_ANY, wxT("Output folder"), wxDefaultPosition, wxSize( 90, -1 ), wxALIGN_RIGHT );
 	m_staticTextOutput->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
-	m_staticTextOutput->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_staticTextOutput->SetBackgroundColour( *wxBLACK );
 	bSizerOutput->Add( m_staticTextOutput, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
-	m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxGetCwd(), wxT("Select a folder"), wxDefaultPosition, wxSize( 200,-1 ), wxDIRP_DEFAULT_STYLE );
-	m_dirPicker->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW ) );
+	m_dirPicker = new wxDirPickerCtrl( this, wxID_ANY, wxGetCwd(), wxT("Select a folder"), wxDefaultPosition, wxSize( 200, -1 ), wxDIRP_DEFAULT_STYLE );
+	m_dirPicker->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) );
+	m_dirPicker->SetBackgroundColour( *wxBLACK );
 	bSizerOutput->Add( m_dirPicker, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	bSizerTop->Add( bSizerOutput, 1, wxEXPAND, 5 );
@@ -187,7 +190,7 @@
     wxFileName f( file );
     wxString ext = f.GetExt();
     wxString name = f.GetName();
-    int in_type;
+    wxBitmapType in_type;
 
     if      ( ext.IsSameAs( wxT("jpg"),  false ) ) in_type = wxBITMAP_TYPE_JPEG;
     else if ( ext.IsSameAs( wxT("jpeg"), false ) ) in_type = wxBITMAP_TYPE_JPEG;
@@ -203,7 +206,7 @@
         return false;
     }
 
-    int out_type = in_type;
+    wxBitmapType out_type = in_type;
     if ( choice_type == 1 ) {
         out_type = wxBITMAP_TYPE_PNG;
         ext = wxT("png");
@@ -232,6 +235,9 @@
         out_type = wxBITMAP_TYPE_JPEG;
         ext = wxT("jpg");
     }
+    else if ( choice_type == 8 ) {
+        // SVG
+    }
 
     wxImage image( file, in_type );
     if ( w == 0 || h == 0 ) {
@@ -259,7 +265,7 @@
         return false;
     }
 
-    int out_type = wxBITMAP_TYPE_INVALID;
+    wxBitmapType out_type = wxBITMAP_TYPE_INVALID;
     wxString out_ext;
     if ( choice_type == 1 ) {
         out_type = wxBITMAP_TYPE_PNG;
@@ -289,6 +295,9 @@
         out_type = wxBITMAP_TYPE_JPEG;
         out_ext = wxT("jpg");
     }
+    else if ( choice_type == 8 ) {
+        // SVG
+    }
 
     wxArrayString files;
     wxDir::GetAllFiles( dir, &files, wxT("*.*"), wxDIR_DEFAULT );
@@ -297,7 +306,7 @@
 
         wxFileName fn( files[i] );
         wxString in_ext = fn.GetExt();
-        int in_type;
+        wxBitmapType in_type;
 
         if      ( in_ext.IsSameAs( wxT("jpg"),  false ) ) in_type = wxBITMAP_TYPE_JPEG;
         else if ( in_ext.IsSameAs( wxT("jpeg"), false ) ) in_type = wxBITMAP_TYPE_JPEG;