Mercurial > mercurial > hgweb_imcv.cgi
changeset 3:cc1f1fa544a4
for wxWidgets 3.1
author | pyon@macmini |
---|---|
date | Sun, 27 Nov 2016 20:15:37 +0900 |
parents | 25a76c128804 |
children | 3fadcf124bb4 |
files | Makefile common.h dndfile.h main.cpp main.h myframe.cpp myframe.h |
diffstat | 3 files changed, 45 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Feb 03 18:51:33 2014 +0900 +++ b/Makefile Sun Nov 27 20:15:37 2016 +0900 @@ -1,5 +1,5 @@ # Makefile for wxWidgets Application -# Last Change: 16-Jan-2014. +# Last Change: 2016-11-27 Sun 15:03:01. # by Takayuki Mutoh # @@ -15,21 +15,21 @@ ifdef COMSPEC WXCXXFLAGS = -I/local/lib/wx/include/msw-unicode-static-3.0 -I/local/include/wx-3.0 -D_LARGEFILE_SOURCE=unknown -D__WXMSW__ -mthreads WXLIBS = -L/local/lib -Wl,--subsystem,windows -mwindows /local/lib/libwx_mswu_richtext-3.0.a /local/lib/libwx_mswu_xrc-3.0.a /local/lib/libwx_mswu_webview-3.0.a /local/lib/libwx_mswu_qa-3.0.a /local/lib/libwx_baseu_net-3.0.a /local/lib/libwx_mswu_html-3.0.a /local/lib/libwx_mswu_adv-3.0.a /local/lib/libwx_mswu_core-3.0.a /local/lib/libwx_baseu_xml-3.0.a /local/lib/libwx_baseu-3.0.a -lwxregexu-3.0 -lwxexpat-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lwxzlib-3.0 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 +LIBS = $(WXLIBS) -static-libgcc -static-libstdc++ EXECUTABLE = $(PROGNAME).exe # For Apple OSX else -WXCXXFLAGS = -I/opt/local/lib/wx/include/osx_cocoa-unicode-2.9 -I/opt/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -WXLIBS = -L/opt/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime -lwx_osx_cocoau_richtext-2.9 -lwx_osx_cocoau_xrc-2.9 -lwx_osx_cocoau_webview-2.9 -lwx_osx_cocoau_html-2.9 -lwx_osx_cocoau_qa-2.9 -lwx_osx_cocoau_adv-2.9 -lwx_osx_cocoau_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9 - +WXCXXFLAGS = -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/lib/wx/include/osx_cocoa-unicode-3.1 -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ +WXLIBS = -L/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_adv-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1 +LIBS = $(WXLIBS) EXECUTABLE = $(PROGNAME).app/Contents/Pkginfo endif CXXFLAGS = $(WXCXXFLAGS) -I./include -I./image -LIBS = $(WXLIBS) -static-libgcc -static-libstdc++ - +# Objects OBJ = $(OBJDIR)/main.o \ $(OBJDIR)/myframe.o @@ -42,9 +42,13 @@ all: $(EXECUTABLE) - +ifdef COMSPEC $(PROGNAME): $(OBJMSW) $(CXX) $^ -o $@ $(LIBS) +else +$(PROGNAME): $(OBJ) + $(CXX) $^ -o $@ $(LIBS) +endif $(OBJDIR)/main.o: main.cpp main.h common.h myframe.h
--- 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;