├── Makefile.am ├── src ├── tsukasa.ico ├── bitmaps │ ├── b_.bmp │ ├── b_.cur │ ├── c_.bmp │ ├── l_.bmp │ ├── m_.bmp │ ├── n_.bmp │ ├── p_.bmp │ ├── s_.bmp │ ├── add_.bmp │ ├── arr_.bmp │ ├── arr_1.bmp │ ├── del_.bmp │ ├── help.bmp │ ├── help_.bmp │ ├── new_.bmp │ ├── nut_.bmp │ ├── rot_.bmp │ ├── src_.bmp │ ├── check_.bmp │ ├── pan_bg.bmp │ ├── pan_shp.bmp │ ├── sc_rot_.bmp │ ├── assdraw3.bmp │ ├── del_cross.bmp │ ├── pan_both.bmp │ ├── pan_shape.bmp │ ├── preview_.bmp │ ├── transform.bmp │ ├── uncheck_.bmp │ └── Copy of assdraw3.bmp ├── xpm │ ├── Makefile.am │ ├── add__xpm.xpm │ ├── b__xpm.xpm │ ├── c__xpm.xpm │ ├── l__xpm.xpm │ ├── m__xpm.xpm │ ├── n__xpm.xpm │ ├── p__xpm.xpm │ ├── s__xpm.xpm │ ├── src__xpm.xpm │ ├── uncheck__xpm.xpm │ ├── check__xpm.xpm │ ├── help__xpm.xpm │ ├── res.cpp │ ├── res.h │ ├── arr__xpm.xpm │ ├── arr_1_xpm.xpm │ ├── pan_shp_xpm.xpm │ ├── help_xpm.xpm │ ├── pan_shape_xpm.xpm │ ├── nut__xpm.xpm │ ├── new__xpm.xpm │ ├── del__xpm.xpm │ ├── pan_bg_xpm.xpm │ ├── preview__xpm.xpm │ ├── pan_both_xpm.xpm │ ├── rot__xpm.xpm │ ├── del_cross_xpm.xpm │ ├── sc_rot__xpm.xpm │ └── appico_xpm.xpm ├── wxAGG │ ├── Makefile.am │ ├── AGGWindow.h │ ├── AGGWindow.cpp │ └── PixelFormatConvertor.h ├── convert.bat ├── _common.hpp ├── agghelper.hpp ├── resource.h ├── Makefile.am ├── t-stringifier.pl ├── agg_conv_bcspline.h ├── canvas_mouse.cpp ├── agg_vcgen_bcspline.h ├── ASSDraw3.layout ├── canvas_mouse.hpp ├── agg_bcspline.h ├── library.hpp ├── enums.hpp ├── assdraw.rc ├── cmd.hpp ├── dlgctrl.hpp ├── settings.hpp ├── include_once.hpp ├── Makefile.win ├── ASSDraw3.dev ├── assdraw.hpp ├── cmd.cpp ├── agg_vcgen_bcspline.cpp ├── assdraw_settings.cpp ├── agg_bcspline.cpp ├── library.cpp ├── canvas.hpp └── settings.cpp ├── osx-bundle.sh ├── configure.in └── assdraw_2008.vcproj /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /src/tsukasa.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/tsukasa.ico -------------------------------------------------------------------------------- /src/bitmaps/b_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/b_.bmp -------------------------------------------------------------------------------- /src/bitmaps/b_.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/b_.cur -------------------------------------------------------------------------------- /src/bitmaps/c_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/c_.bmp -------------------------------------------------------------------------------- /src/bitmaps/l_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/l_.bmp -------------------------------------------------------------------------------- /src/bitmaps/m_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/m_.bmp -------------------------------------------------------------------------------- /src/bitmaps/n_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/n_.bmp -------------------------------------------------------------------------------- /src/bitmaps/p_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/p_.bmp -------------------------------------------------------------------------------- /src/bitmaps/s_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/s_.bmp -------------------------------------------------------------------------------- /src/bitmaps/add_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/add_.bmp -------------------------------------------------------------------------------- /src/bitmaps/arr_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/arr_.bmp -------------------------------------------------------------------------------- /src/bitmaps/arr_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/arr_1.bmp -------------------------------------------------------------------------------- /src/bitmaps/del_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/del_.bmp -------------------------------------------------------------------------------- /src/bitmaps/help.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/help.bmp -------------------------------------------------------------------------------- /src/bitmaps/help_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/help_.bmp -------------------------------------------------------------------------------- /src/bitmaps/new_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/new_.bmp -------------------------------------------------------------------------------- /src/bitmaps/nut_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/nut_.bmp -------------------------------------------------------------------------------- /src/bitmaps/rot_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/rot_.bmp -------------------------------------------------------------------------------- /src/bitmaps/src_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/src_.bmp -------------------------------------------------------------------------------- /src/bitmaps/check_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/check_.bmp -------------------------------------------------------------------------------- /src/bitmaps/pan_bg.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/pan_bg.bmp -------------------------------------------------------------------------------- /src/bitmaps/pan_shp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/pan_shp.bmp -------------------------------------------------------------------------------- /src/bitmaps/sc_rot_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/sc_rot_.bmp -------------------------------------------------------------------------------- /src/xpm/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LIBRARIES = libres.a 2 | 3 | libres_a_SOURCES = res.cpp res.h 4 | 5 | -------------------------------------------------------------------------------- /src/bitmaps/assdraw3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/assdraw3.bmp -------------------------------------------------------------------------------- /src/bitmaps/del_cross.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/del_cross.bmp -------------------------------------------------------------------------------- /src/bitmaps/pan_both.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/pan_both.bmp -------------------------------------------------------------------------------- /src/bitmaps/pan_shape.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/pan_shape.bmp -------------------------------------------------------------------------------- /src/bitmaps/preview_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/preview_.bmp -------------------------------------------------------------------------------- /src/bitmaps/transform.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/transform.bmp -------------------------------------------------------------------------------- /src/bitmaps/uncheck_.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/uncheck_.bmp -------------------------------------------------------------------------------- /src/bitmaps/Copy of assdraw3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aegisub/assdraw/HEAD/src/bitmaps/Copy of assdraw3.bmp -------------------------------------------------------------------------------- /src/wxAGG/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CXXFLAGS = @WX_CPPFLAGS@ @LIBAGG_CFLAGS@ 2 | 3 | noinst_LIBRARIES = libaggwindow.a 4 | 5 | libaggwindow_a_SOURCES = \ 6 | AGGWindow.cpp \ 7 | AGGWindow.h \ 8 | PixelFormatConvertor.h 9 | -------------------------------------------------------------------------------- /src/convert.bat: -------------------------------------------------------------------------------- 1 | perl t-stringifier.pl agg_bcspline.h agg_conv_bcspline.h agg_vcgen_bcspline.h resource.h agg_bcspline.cpp agg_vcgen_bcspline.cpp assdraw.cpp assdraw_settings.cpp canvas.cpp canvas_mouse.cpp cmd.cpp dlgctrl.cpp engine.cpp library.cpp settings.cpp 2 | pause -------------------------------------------------------------------------------- /src/_common.hpp: -------------------------------------------------------------------------------- 1 | 2 | #include "wx/wxprec.h" 3 | 4 | #ifdef __BORLANDC__ 5 | #pragma hdrstop 6 | #endif 7 | 8 | #ifndef WX_PRECOMP 9 | #include "wx/wx.h" 10 | #endif 11 | 12 | #define TITLE wxT("ASSDraw3") 13 | 14 | #define __DPDS__ wxDefaultPosition, wxDefaultSize 15 | -------------------------------------------------------------------------------- /src/agghelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "agg_path_storage.h" 4 | 5 | class agghelper 6 | { 7 | public: 8 | 9 | static agg::path_storage RectanglePath(double left, double right, double top, double bottom) 10 | { 11 | agg::path_storage path; 12 | path.move_to(left,top); 13 | path.line_to(right,top); 14 | path.line_to(right,bottom); 15 | path.line_to(left,bottom); 16 | path.line_to(left,top); 17 | return path; 18 | } 19 | 20 | }; 21 | -------------------------------------------------------------------------------- /src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by assdraw.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 105 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1000 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /src/xpm/add__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *add_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c black", 6 | ". c #99999999FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XXXXX XXXXX", 10 | "XXXXX .... XXXXX", 11 | "XXXXX .... XXXXX", 12 | "XXXXX .... XXXXX", 13 | "X .... X", 14 | "X ............ X", 15 | "X ............ X", 16 | "X ............ X", 17 | "X ............ X", 18 | "X .... X", 19 | "XXXXX .... XXXXX", 20 | "XXXXX .... XXXXX", 21 | "XXXXX .... XXXXX", 22 | "XXXXX XXXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/b__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *b__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XX XXXX", 14 | "XXXXX XXX", 15 | "XXXXX XXXX XXX", 16 | "XXXXX XXXX XXX", 17 | "XXXXX XXXX", 18 | "XXXXX XXX", 19 | "XXXXX XXXX XXX", 20 | "XXXXX XXXX XXX", 21 | "XXXXX XXX", 22 | "XXXXX XXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/c__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *c__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XXXX XXXXX", 14 | "XXXXXX XXXX", 15 | "XXXXX XX XXX", 16 | "XXXXX XXXX XXXX", 17 | "XXXXX XXXXXXXXX", 18 | "XXXXX XXXXXXXXX", 19 | "XXXXX XXXX XXXX", 20 | "XXXXX XX XXX", 21 | "XXXXXX XXXX", 22 | "XXXXXXX XXXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/l__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *l__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XX XXXXXXXXX", 14 | "XXXXX XXXXXXXXX", 15 | "XXXXX XXXXXXXXX", 16 | "XXXXX XXXXXXXXX", 17 | "XXXXX XXXXXXXXX", 18 | "XXXXX XXXXXXXXX", 19 | "XXXXX XXXXXXXXX", 20 | "XXXXX XXXXXXXXX", 21 | "XXXXX XXXX", 22 | "XXXXX XXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/m__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *m__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XXXXXXXXXXXXX", 14 | "XXXXX XXX XX", 15 | "XXXXX XXX XX", 16 | "XXXXX X XX", 17 | "XXXXX X XX", 18 | "XXXXX X X X XX", 19 | "XXXXX X X X XX", 20 | "XXXXX X X XX", 21 | "XXXXX X X XX", 22 | "XXXXX XX XX XX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/n__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *n__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XX XXXX XXX", 14 | "XXXXX XXX XXX", 15 | "XXXXX XX XXX", 16 | "XXXXX XX XXX", 17 | "XXXXX X X XXX", 18 | "XXXXX X X XXX", 19 | "XXXXX XX XXX", 20 | "XXXXX XX XXX", 21 | "XXXXX XXX XXX", 22 | "XXXXX XXXX XXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/p__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *p__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XX XXXXX", 14 | "XXXXX XXXX", 15 | "XXXXX XXX XXXX", 16 | "XXXXX XXX XXXX", 17 | "XXXXX XXXX", 18 | "XXXXX XXXXX", 19 | "XXXXX XXXXXXXXX", 20 | "XXXXX XXXXXXXXX", 21 | "XXXXX XXXXXXXXX", 22 | "XXXXX XXXXXXXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/s__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *s__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 3 1", 5 | " c gray20", 6 | ". c #12120000FFFF", 7 | "X c None", 8 | /* pixels */ 9 | "XX.XXXXXXXXXXXXX", 10 | "XX.XXXXXXXXXXXXX", 11 | ".....XXXXXXXXXXX", 12 | "XX.XXXXXXXXXXXXX", 13 | "XX.XXX XXXXX", 14 | "XXXXX XXXX", 15 | "XXXXX XXX XXXX", 16 | "XXXXX XXXXXXXXX", 17 | "XXXXX XXXXX", 18 | "XXXXXX XXXX", 19 | "XXXXXXXXXX XXXX", 20 | "XXXXX XXX XXXX", 21 | "XXXXX XXXX", 22 | "XXXXXX XXXXX", 23 | "XXXXXXXXXXXXXXXX" 24 | }; 25 | -------------------------------------------------------------------------------- /src/xpm/src__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *src__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 4 1", 5 | " c black", 6 | ". c #0000BFBFBFBF", 7 | "X c cyan", 8 | "o c None", 9 | /* pixels */ 10 | "oooooo ooooooo", 11 | "ooo oo . oo oooo", 12 | "oo X o o X ooo", 13 | "o X. XXX .. oo", 14 | "oo XX..... ooo", 15 | "ooo X. .. oooo", 16 | " X. ooo .. o", 17 | " X .. ooo X. . o", 18 | " .. ooo X. o", 19 | "ooo .. X. oooo", 20 | "oo ...XX.. ooo", 21 | "o X. ... .. oo", 22 | "oo . o o . ooo", 23 | "ooo oo . oo oooo", 24 | "oooooo ooooooo" 25 | }; 26 | -------------------------------------------------------------------------------- /src/xpm/uncheck__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *uncheck_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 5 1", 5 | " c gray25", 6 | ". c #808080808080", 7 | "X c #D4D4D0D0C8C8", 8 | "o c gray100", 9 | "O c None", 10 | /* pixels */ 11 | "OOOOOOOOOOOOOOOO", 12 | "OO............OO", 13 | "OO. XOO", 14 | "OO. oooooooooXOO", 15 | "OO. oooooooooXOO", 16 | "OO. oooooooooXOO", 17 | "OO. oooooooooXOO", 18 | "OO. oooooooooXOO", 19 | "OO. oooooooooXOO", 20 | "OO. oooooooooXOO", 21 | "OO. oooooooooXOO", 22 | "OO. oooooooooXOO", 23 | "OO.XXXXXXXXXXXOO", 24 | "OOOOOOOOOOOOOOOO", 25 | "OOOOOOOOOOOOOOOO" 26 | }; 27 | -------------------------------------------------------------------------------- /src/xpm/check__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *check_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 6 1", 5 | " c black", 6 | ". c gray25", 7 | "X c #808080808080", 8 | "o c #D4D4D0D0C8C8", 9 | "O c gray100", 10 | "+ c None", 11 | /* pixels */ 12 | "++++++++++++++++", 13 | "++XXXXXXXXXXXX++", 14 | "++X..........o++", 15 | "++X.OOOOOOOOOo++", 16 | "++X.OOOOOOO Oo++", 17 | "++X.OOOOOO Oo++", 18 | "++X.O OOO Oo++", 19 | "++X.O O OOo++", 20 | "++X.O OOOo++", 21 | "++X.OO OOOOo++", 22 | "++X.OOO OOOOOo++", 23 | "++X.OOOOOOOOOo++", 24 | "++Xooooooooooo++", 25 | "++++++++++++++++", 26 | "++++++++++++++++" 27 | }; 28 | -------------------------------------------------------------------------------- /src/xpm/help__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *help__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 11 1", 5 | " c #46464B4B5C5C", 6 | ". c #FFFFCCCC0000", 7 | "X c #FAFAF3F30000", 8 | "o c #FBFBE2E24949", 9 | "O c #4C4C2D2D9B9B", 10 | "+ c #7A7A7E7E8D8D", 11 | "@ c #59594F4FBFBF", 12 | "# c #65655B5BEFEF", 13 | "$ c #FFFFFFFFABAB", 14 | "% c #82829494F7F7", 15 | "& c None", 16 | /* pixels */ 17 | "&&&&++++++++&&&&", 18 | "&&++XXXXXXXo &&", 19 | "&+XX$$@@@@$$X. &", 20 | "&+X$$@@%#@@$$X +", 21 | "+X$$$@#$$@@$$$o ", 22 | "+X$$$$$$%@O$$$X ", 23 | "+X$$$$$%@O$$$$X ", 24 | "+X$$$$$@O$$$$$o ", 25 | "+X$$$$$$$$$$$Xo ", 26 | "+oX$$$$@@$$$$X. ", 27 | "&+XX$$$@@$$XX. &", 28 | "&& oXX$$$$Xo. &&", 29 | "&&& oXXXo &&&", 30 | "&&&&&& &&&&&", 31 | "&&&&&&&&&&&&&&&&" 32 | }; 33 | -------------------------------------------------------------------------------- /src/xpm/res.cpp: -------------------------------------------------------------------------------- 1 | #define static 2 | #include "appico_xpm.xpm" 3 | #include "add__xpm.xpm" 4 | #include "arr_1_xpm.xpm" 5 | #include "arr__xpm.xpm" 6 | #include "assdraw3_xpm.xpm" 7 | #include "b__xpm.xpm" 8 | #include "c__xpm.xpm" 9 | #include "check__xpm.xpm" 10 | #include "del__xpm.xpm" 11 | #include "del_cross_xpm.xpm" 12 | #include "help__xpm.xpm" 13 | #include "help_xpm.xpm" 14 | #include "l__xpm.xpm" 15 | #include "m__xpm.xpm" 16 | #include "n__xpm.xpm" 17 | #include "new__xpm.xpm" 18 | #include "nut__xpm.xpm" 19 | #include "p__xpm.xpm" 20 | #include "pan_bg_xpm.xpm" 21 | #include "pan_both_xpm.xpm" 22 | #include "pan_shape_xpm.xpm" 23 | #include "pan_shp_xpm.xpm" 24 | #include "preview__xpm.xpm" 25 | #include "rot__xpm.xpm" 26 | #include "s__xpm.xpm" 27 | #include "sc_rot__xpm.xpm" 28 | #include "src__xpm.xpm" 29 | #include "transform_xpm.xpm" 30 | #include "uncheck__xpm.xpm" 31 | -------------------------------------------------------------------------------- /src/xpm/res.h: -------------------------------------------------------------------------------- 1 | extern char *appico_xpm[]; 2 | extern char *add_xpm[]; 3 | extern char *arr___xpm[]; 4 | extern char *arr__xpm[]; 5 | extern char *assdraw3__xpm[]; 6 | extern char *b__xpm[]; 7 | extern char *c__xpm[]; 8 | extern char *check_xpm[]; 9 | extern char *del__xpm[]; 10 | extern char *delcross_xpm[]; 11 | extern char *help__xpm[]; 12 | extern char *help_xpm[]; 13 | extern char *l__xpm[]; 14 | extern char *m__xpm[]; 15 | extern char *n__xpm[]; 16 | extern char *new__xpm[]; 17 | extern char *nut__xpm[]; 18 | extern char *p__xpm[]; 19 | extern char *pan_bg_xpm[]; 20 | extern char *pan_both_xpm[]; 21 | extern char *pan_shape_xpm[]; 22 | extern char *pan_shp_xpm[]; 23 | extern char *preview__xpm[]; 24 | extern char *rot__xpm[]; 25 | extern char *s__xpm[]; 26 | extern char *sc_rot__xpm[]; 27 | extern char *src__xpm[]; 28 | extern char *transform_xpm[]; 29 | extern char *uncheck_xpm[]; 30 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUFFIXES = .cpp 2 | 3 | SUBDIRS = wxAGG xpm 4 | 5 | AM_CXXFLAGS = @WX_CPPFLAGS@ @LIBAGG_CFLAGS@ 6 | 7 | bin_PROGRAMS = assdraw 8 | #assdraw_CPPFLAGS = 9 | assdraw_LDFLAGS = @WX_LIBS@ @LIBAGG_LIBS@ 10 | assdraw_LDADD = wxAGG/libaggwindow.a xpm/libres.a 11 | 12 | assdraw_SOURCES = \ 13 | agg_bcspline.cpp \ 14 | agg_vcgen_bcspline.cpp \ 15 | assdraw.cpp \ 16 | assdraw_settings.cpp \ 17 | canvas.cpp \ 18 | canvas_mouse.cpp \ 19 | cmd.cpp \ 20 | dlgctrl.cpp \ 21 | engine.cpp \ 22 | library.cpp \ 23 | settings.cpp 24 | 25 | assdraw_SOURCES += \ 26 | agg_bcspline.h \ 27 | agg_conv_bcspline.h \ 28 | agg_vcgen_bcspline.h \ 29 | resource.h 30 | 31 | EXTRA_DIST = \ 32 | _common.hpp \ 33 | agghelper.hpp 34 | assdraw.hpp \ 35 | canvas.hpp \ 36 | canvas_mouse.hpp \ 37 | cmd.hpp \ 38 | dlgctrl.hpp \ 39 | engine.hpp \ 40 | enums.hpp \ 41 | include_once.hpp \ 42 | library.hpp \ 43 | settings.hpp 44 | -------------------------------------------------------------------------------- /osx-bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | BUNDLE_ROOT="$(dirname $0)/Assdraw.app/" 6 | SRC_DIR="$(dirname $0)" 7 | 8 | if test -d "${BUNDLE_ROOT}"; then 9 | rm -rf "${BUNDLE_ROOT}" 10 | fi 11 | 12 | mkdir -p "${BUNDLE_ROOT}/Contents/MacOS" 13 | 14 | cp "${SRC_DIR}/src/assdraw" "${BUNDLE_ROOT}/Contents/MacOS/assdraw" 15 | 16 | python ../../aegisub/tools/osx-fix-libs.py "${BUNDLE_ROOT}/Contents/MacOS/assdraw" 17 | 18 | cat << 'EOF' > "${BUNDLE_ROOT}/Info.plist" 19 | 20 | 21 | 22 | 23 | CFBundleInfoDictionaryVersion 24 | 6.0 25 | CFBundleDevelopmentRegion 26 | English 27 | CFBundleExecutable 28 | assdraw 29 | CFBundleIdentifier 30 | com.aegisub.assdraw 31 | CFBundleName 32 | ASSDraw3 33 | CFBundleDisplayName 34 | ASSDraw3 35 | CFBundlePackageType 36 | APPL 37 | LSHasLocalizedDisplayName 38 | 39 | 40 | 41 | EOF 42 | -------------------------------------------------------------------------------- /src/xpm/arr__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *arr__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 43 1", 5 | " c black", 6 | ". c gray1", 7 | "X c gray2", 8 | "o c gray9", 9 | "O c #282828282828", 10 | "+ c #2A2A2A2A2A2A", 11 | "@ c #3A3A3A3A3A3A", 12 | "# c #3C3C3C3C3C3C", 13 | "$ c #494949494949", 14 | "% c gray35", 15 | "& c #747473737373", 16 | "* c #777777777777", 17 | "= c #888887878787", 18 | "- c #8F8F8E8E8E8E", 19 | "; c gray60", 20 | ": c #9D9D9D9D9D9D", 21 | "> c #A2A29F9F9F9F", 22 | ", c #B6B6B6B6B6B6", 23 | "< c gray74", 24 | "1 c #C5C5C5C5C5C5", 25 | "2 c #C9C9C9C9CACA", 26 | "3 c gray80", 27 | "4 c #CDCDCDCDCDCD", 28 | "5 c #CECECECECECE", 29 | "6 c #D0D0D0D0D0D0", 30 | "7 c #D1D1D1D1D0D0", 31 | "8 c gray82", 32 | "9 c gray83", 33 | "0 c #D7D7D7D7D6D6", 34 | "q c #D7D7D7D7D7D7", 35 | "w c gainsboro", 36 | "e c #DFDFDFDFDFDF", 37 | "r c #E2E2E2E2E2E2", 38 | "t c gray90", 39 | "y c #E6E6E6E6E6E6", 40 | "u c #EAEAEAEAEAEA", 41 | "i c #ECECECECECEC", 42 | "p c gray93", 43 | "a c #F2F2F3F3F2F2", 44 | "s c #F9F9F9F9F9F9", 45 | "d c gray99", 46 | "f c gray100", 47 | "g c None", 48 | /* pixels */ 49 | "ggggyggggggggggg", 50 | "gggg-9gggggggggg", 51 | "gggg- 8ggggggggg", 52 | "gggg-0 5gggggggg", 53 | "gggg-f,#5ggggggg", 54 | "gggg-fs* 5gggggg", 55 | "gggg-dp,* 4ggggg", 56 | "gggg-ae2>* 5gggg", 57 | "gggg-t7X uggg", 58 | "gggg-0% X193gggg", 59 | "gggg-$<@ &gggggg", 60 | "gggg-6w: oqggggg", 61 | "ggggiggrO =ggggg", 62 | "gggggggw;.+pgggg", 63 | "ggggggggt +ugggg" 64 | }; 65 | -------------------------------------------------------------------------------- /src/xpm/arr_1_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *arr___xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 43 1", 5 | " c black", 6 | ". c gray1", 7 | "X c gray2", 8 | "o c gray9", 9 | "O c #282828282828", 10 | "+ c #2A2A2A2A2A2A", 11 | "@ c #3A3A3A3A3A3A", 12 | "# c #3C3C3C3C3C3C", 13 | "$ c #494949494949", 14 | "% c gray35", 15 | "& c #747473737373", 16 | "* c #777777777777", 17 | "= c #888887878787", 18 | "- c #8F8F8E8E8E8E", 19 | "; c gray60", 20 | ": c #9D9D9D9D9D9D", 21 | "> c #A2A29F9F9F9F", 22 | ", c #B6B6B6B6B6B6", 23 | "< c gray74", 24 | "1 c #C5C5C5C5C5C5", 25 | "2 c #C9C9C9C9CACA", 26 | "3 c gray80", 27 | "4 c #CDCDCDCDCDCD", 28 | "5 c #CECECECECECE", 29 | "6 c #D0D0D0D0D0D0", 30 | "7 c #D1D1D1D1D0D0", 31 | "8 c gray82", 32 | "9 c gray83", 33 | "0 c #D7D7D7D7D6D6", 34 | "q c #D7D7D7D7D7D7", 35 | "w c gainsboro", 36 | "e c #DFDFDFDFDFDF", 37 | "r c #E2E2E2E2E2E2", 38 | "t c gray90", 39 | "y c #E6E6E6E6E6E6", 40 | "u c #EAEAEAEAEAEA", 41 | "i c #ECECECECECEC", 42 | "p c gray93", 43 | "a c #F2F2F3F3F2F2", 44 | "s c #F9F9F9F9F9F9", 45 | "d c gray99", 46 | "f c gray100", 47 | "g c None", 48 | /* pixels */ 49 | "ggggyggggggggggg", 50 | "gggg-9gggggggggg", 51 | "gggg- 8ggggggggg", 52 | "gggg-0 5gggggggg", 53 | "gggg-f,#5ggggggg", 54 | "gggg-fs* 5gggggg", 55 | "gggg-dp,* 4ggggg", 56 | "gggg-ae2>* 5gggg", 57 | "gggg-t7X uggg", 58 | "gggg-0% X193gggg", 59 | "gggg-$<@ &gggggg", 60 | "gggg-6w: oqggggg", 61 | "ggggiggrO =ggggg", 62 | "gggggggw;.+pgggg", 63 | "ggggggggt +ugggg" 64 | }; 65 | -------------------------------------------------------------------------------- /src/xpm/pan_shp_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *pan_shp_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "24 15 36 1", 5 | " c #0D0D0D0D6767", 6 | ". c #131313136969", 7 | "X c #181818186C6C", 8 | "o c #1A1A1A1A6E6E", 9 | "O c #1E1E1E1E6F6F", 10 | "+ c #242424247272", 11 | "@ c #2A2A2A2A7575", 12 | "# c #303030307878", 13 | "$ c #363636367B7B", 14 | "% c #3C3C3C3C7E7E", 15 | "& c #606060606060", 16 | "* c #FFFF7F7F7F7F", 17 | "= c #424242428181", 18 | "- c #484848488484", 19 | "; c #5A5A5A5A8E8E", 20 | ": c #5F5F5F5F9090", 21 | "> c #656565659292", 22 | ", c #777777779B9B", 23 | "< c #7D7D7D7D9E9E", 24 | "1 c #7E7E7E7E9F9F", 25 | "2 c #A1A14949D3D3", 26 | "3 c #A6A64D4DD6D6", 27 | "4 c #A9A95050D7D7", 28 | "5 c #AAAA5151D8D8", 29 | "6 c #ACAC5353D9D9", 30 | "7 c #AFAF5656DADA", 31 | "8 c #B5B55C5CDDDD", 32 | "9 c #B8B85F5FDFDF", 33 | "0 c #83838383A1A1", 34 | "q c #8F8F8F8FA7A7", 35 | "w c #9B9B9B9BADAD", 36 | "e c #A1A1A1A1B0B0", 37 | "r c #A7A7A7A7B3B3", 38 | "t c #ADADADADB6B6", 39 | "y c #B9B9B9B9BCBC", 40 | "u c None", 41 | /* pixels */ 42 | "uuuuu&uuuuuuuuuuuuuuuuuu", 43 | "uuuuu&uuuuuuuuuuuuuuuuuu", 44 | "uuuuu&uuuuuuuuuuuuuuuuuu", 45 | "uuuuu&uuuuuuuuwOX=;uu", 50 | "u&uuu&***&uuu,-99993@yuu", 51 | "u&&&&&&&&&uuuu;>998@wuuu", 52 | "u&uuuuuuu&uuuuu%09::uuuu", 53 | "u&uuuuuuu&uuuuuy@1@yuuuu", 54 | "u&uuuuuuu&uuuuuur euuuuu", 55 | "u&uuuuuuu&uuuuuuuuuuuuuu", 56 | "u&&&&&&&&&uuuuuuuuuuuuuu" 57 | }; 58 | -------------------------------------------------------------------------------- /src/t-stringifier.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | ########################### 4 | # t-stringifier.pl - replaces "strings" with _T("strings") 5 | # 6 | # Usage: t-stringifier.pl file1 [file2 [file...]] 7 | # NOTE: changes existing files in place so backup stuff or rewrite the script 8 | # (more specifically comment out the rename() call at the end of the main loop) 9 | # if you're paranoid. 10 | # 11 | # Written by Karl Blomster 2008 12 | # This script is in the public domain. 13 | ########################### 14 | 15 | 16 | use warnings; 17 | use strict; 18 | 19 | my @infiles = @ARGV; 20 | 21 | foreach my $infile (@infiles) { 22 | my $outfile = $infile . ".out"; 23 | open(INFILE, "<", $infile) or die("Couldn't open $infile for reading: $!"); 24 | open(OUTFILE, ">", $outfile) or die("Couldn't open $outfile for writing: $!"); 25 | 26 | print("Processing: $infile \n"); 27 | 28 | while () { 29 | print OUTFILE $_ and next() if (m!^#\s*include!); 30 | 31 | my $line = $_; 32 | 33 | $line =~ s/(_T\(|_\(|wxT\()?"(.*?)(? c #52528282D0D0", 22 | ", c #63638E8ED5D5", 23 | "< c #69699292D7D7", 24 | "1 c #71719898D9D9", 25 | "2 c #79799E9EDBDB", 26 | "3 c #7C7CA0A0DCDC", 27 | "4 c #8989A9A9DFDF", 28 | "5 c #8C8CACACE0E0", 29 | "6 c #9595B2B2E3E3", 30 | "7 c #9A9AB6B6E4E4", 31 | "8 c #9B9BB7B7E5E5", 32 | "9 c #A6A6BFBFE8E8", 33 | "0 c #A8A8C0C0E8E8", 34 | "q c #ADADC4C4E9E9", 35 | "w c #B1B1C7C7EBEB", 36 | "e c #B8B8CCCCECEC", 37 | "r c #BEBED0D0EEEE", 38 | "t c #C4C4D5D5F0F0", 39 | "y c #CBCBD9D9F1F1", 40 | "u c #CCCCDADAF2F2", 41 | "i c #D2D2DFDFF4F4", 42 | "p c #D9D9E4E4F5F5", 43 | "a c #DCDCE6E6F6F6", 44 | "s c #DFDFE8E8F7F7", 45 | "d c #E2E2EAEAF8F8", 46 | "f c #EAEAF0F0FAFA", 47 | "g c #EDEDF2F2FBFB", 48 | "h c #F0F0F5F5FCFC", 49 | "j c #F5F5F8F8FDFD", 50 | "k c #F7F7F9F9FDFD", 51 | "l c #FAFAFCFCFEFE", 52 | "z c #FDFDFEFEFFFF", 53 | "x c gray100", 54 | "c c None", 55 | /* pixels */ 56 | "ccc%%%%%%%o-cccc", 57 | "ccc%urw073%4-ccc", 58 | "ccc%iurw07%k4>cc", 59 | "cc9$$$<0w0%kk4$c", 60 | "c1 @2,O c #42424E4E9595", 22 | ", c #484854549797", 23 | "< c #4E4E59599999", 24 | "1 c #5A5A64649D9D", 25 | "2 c #66666F6FA2A2", 26 | "3 c #78787F7FA8A8", 27 | "4 c #39395050D3D3", 28 | "5 c #3C3C5252D4D4", 29 | "6 c #3F3F5555D5D5", 30 | "7 c #42425858D6D6", 31 | "8 c #45455A5AD7D7", 32 | "9 c #47475C5CD7D7", 33 | "0 c #4B4B6060D9D9", 34 | "q c #54546868DCDC", 35 | "w c #5A5A6D6DDEDE", 36 | "e c #5D5D7070DFDF", 37 | "r c #60607373E0E0", 38 | "t c #84848A8AACAC", 39 | "y c #8A8A8F8FAEAE", 40 | "u c #90909595B0B0", 41 | "i c #A2A2A5A5B6B6", 42 | "p c #A8A8AAAAB8B8", 43 | "a c #AEAEB0B0BABA", 44 | "s c #B4B4B5B5BCBC", 45 | "d c #BABABBBBBEBE", 46 | "f c None", 47 | /* pixels */ 48 | "ffffOfffffffffffffffffffffffff", 49 | "ffff fffffffffffffffffffffffff", 50 | "ffff fffffffffffffffu%3fffffff", 51 | "ffff fffffffffffffi:=9,$3fffff", 52 | "X .fffffffa<&7rrrq,$3fff", 53 | " fff +++ fffffd2&4rrrrrrrq,$3f", 54 | " fff +++ fffft&1wrrrrrrrrrrq,=", 55 | " fff +++ fff#;qrrrrrrrrrrrrr5,", 56 | " fff +++ fff>6rrrrrrrrrrrq1@,p", 57 | " fffy-rrrrrrrrr8:$2aff", 58 | " fffffff fffd@wrrrrre4&-tfffff", 59 | " fffffff ffff,5rrrq1@ c #98984E4E4E4E", 22 | ", c #9A9A54545454", 23 | "< c #9D9D5A5A5A5A", 24 | "1 c #A1A165656565", 25 | "2 c #A3A36B6B6B6B", 26 | "3 c #A5A56F6F6F6F", 27 | "4 c #A5A571717171", 28 | "5 c #A7A777777777", 29 | "6 c #A9A97D7D7D7D", 30 | "7 c #0A0A1C1C8181", 31 | "8 c #0C0C1C1C8080", 32 | "9 c #0D0D1F1F8282", 33 | "0 c #151525258484", 34 | "q c #151525258585", 35 | "w c #171728288686", 36 | "e c #1F1F2F2F8888", 37 | "r c #242432328A8A", 38 | "t c #2A2A38388C8C", 39 | "y c #2D2D3B3B8D8D", 40 | "u c #61616A6A9F9F", 41 | "i c #64646C6CA0A0", 42 | "p c #74747C7CA6A6", 43 | "a c #77777E7EA7A7", 44 | "s c #AFAF8F8F8F8F", 45 | "d c #B3B39B9B9B9B", 46 | "f c #83838989ABAB", 47 | "g c #89898E8EADAD", 48 | "h c #8D8D9292AEAE", 49 | "j c #8F8F9494AFAF", 50 | "k c #9B9B9F9FB3B3", 51 | "l c #B5B5A1A1A1A1", 52 | "z c #B7B7A7A7A7A7", 53 | "x c #B9B9ADADADAD", 54 | "c c #A7A7A9A9B7B7", 55 | "v c #BBBBB3B3B3B3", 56 | "b c #B3B3B4B4BBBB", 57 | "n c #BDBDB9B9B9B9", 58 | "m c #B9B9BABABDBD", 59 | "M c None", 60 | /* pixels */ 61 | "# @nMMMM", 62 | " MMMMebMMM:5MMMM", 63 | " MMMc9.MMMs=MMMM", 64 | " ......pMMM#xMMM", 65 | " h........0<1MMM", 66 | " Mc......tkd*MMM", 67 | " MMuX....bMM&lMM", 68 | " MMy.....jMM1d7.MM...fMM=sM", 71 | "z4*$,dMMa.wmM5:M", 72 | "MMMz2*$,dgqiMv#n", 73 | "MMMMMMz2*$o8MM;6", 74 | "MMMMMMMMMz2*$,3-", 75 | "MMMMMMMMMMMMz2%O" 76 | }; 77 | -------------------------------------------------------------------------------- /src/xpm/new__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *new__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 64 1", 5 | " c black", 6 | ". c gray10", 7 | "X c #373737373737", 8 | "o c #434343434343", 9 | "O c #464646464646", 10 | "+ c #484848484848", 11 | "@ c #525251515050", 12 | "# c #565656565656", 13 | "$ c #595958585353", 14 | "% c #5F5F5F5F5F5F", 15 | "& c #606060606060", 16 | "* c gray38", 17 | "= c #676767676767", 18 | "- c DimGray", 19 | "; c #6A6A6A6A6A6A", 20 | ": c #6E6E6D6D6A6A", 21 | "> c gray43", 22 | ", c #6F6F6F6F6F6F", 23 | "< c gray44", 24 | "1 c #767676767676", 25 | "2 c #797979797979", 26 | "3 c #7C7C7C7C7C7C", 27 | "4 c #7F7F7F7F7F7F", 28 | "5 c #818181818181", 29 | "6 c #8D8D8D8D8D8D", 30 | "7 c #8E8E8E8E8E8E", 31 | "8 c #939393939393", 32 | "9 c gray58", 33 | "0 c #959595959595", 34 | "q c gray59", 35 | "w c gray60", 36 | "e c #9A9A9A9A9A9A", 37 | "r c #A4A4A1A19696", 38 | "t c #A8A8A6A69C9C", 39 | "y c #A7A7A7A7A7A7", 40 | "u c gray66", 41 | "i c #B1B1AFAFA5A5", 42 | "p c #B3B3B1B1A8A8", 43 | "a c #BDBDBBBBAFAF", 44 | "s c gray70", 45 | "d c #CDCDCACABCBC", 46 | "f c #C8C8C8C8C8C8", 47 | "g c #CACACACACACA", 48 | "h c #CDCDCDCDCDCD", 49 | "j c gray81", 50 | "k c gray83", 51 | "l c #D5D5D5D5D5D5", 52 | "z c #D7D7D7D7D7D7", 53 | "x c #D8D8D8D8D8D8", 54 | "c c gray86", 55 | "v c #DFDFDFDFDFDF", 56 | "b c #E7E7E4E4D3D3", 57 | "n c #E4E4E4E4E4E4", 58 | "m c #E7E7E7E7E7E7", 59 | "M c gray91", 60 | "N c gray92", 61 | "B c #EEEEEEEEEEEE", 62 | "V c #EFEFEFEFEFEF", 63 | "C c #F1F1F1F1F1F1", 64 | "Z c gray95", 65 | "A c #F3F3F3F3F3F3", 66 | "S c #F6F6F6F6F6F6", 67 | "D c gray100", 68 | "F c None", 69 | /* pixels */ 70 | "FFFFFFFFFFFFFFFF", 71 | "FFFFFFFFFFFFFFFF", 72 | "FFFFFFFa@-------", 73 | "FFFFFFaOZBnzhf,;", 74 | "FFFFFaOZCmcjf<0$", 75 | "FFFFaOZANvkf9755>%+2q.rFF", 79 | "b;sxxxklf*6.rFFF", 80 | "p8SSSSSSu4.rFFFF", 81 | "1MDDDDDV&.rFFFFF", 82 | "ooooooo+ rFFFFFF", 83 | "FFFFFFFFFFFFFFFF", 84 | "FFFFFFFFFFFFFFFF" 85 | }; 86 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.61) 2 | 3 | ####### 4 | # Setup 5 | ####### 6 | AC_INIT([assdraw], [1.0.0]) 7 | AC_CONFIG_SRCDIR([src/engine.cpp]) 8 | AC_CONFIG_HEADER([config.h]) 9 | AM_INIT_AUTOMAKE([foreign]) 10 | AC_CANONICAL_HOST 11 | AC_CONFIG_MACRO_DIR([m4]) 12 | 13 | #################### 14 | # Check for programs 15 | #################### 16 | AC_PROG_CC 17 | AC_PROG_CXX 18 | AC_LANG(C++) 19 | AC_PROG_LIBTOOL 20 | AC_PROG_INSTALL 21 | PKG_PROG_PKG_CONFIG([0.20]) 22 | 23 | ################# 24 | # Developers only 25 | ################# 26 | AM_MAINTAINER_MODE 27 | 28 | AC_ARG_VAR([DEBUG_FLAGS], [Debug flag to use with --enable debug (default: -g)]) 29 | if test -z "$DEBUG_FLAGS"; then 30 | DEBUG_FLAGS="-g"; 31 | fi 32 | 33 | AC_MSG_CHECKING([whether to turn on debugging]) 34 | AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging (default=no)]) 35 | if test "$enable_debug" = "yes"; then 36 | AC_MSG_RESULT([yes ($DEBUG_FLAGS)]) 37 | CPPFLAGS="$DEBUG_FLAGS $CPPFLAGS" 38 | else 39 | AC_MSG_RESULT([no]) 40 | fi 41 | 42 | AC_ARG_ENABLE(build-dist) 43 | if test "$enable_build_dist" = "yes"; then 44 | SVN_VERSION=`svnversion .` 45 | PACKAGE_STRING="${PACKAGE_STRING}-r$SVN_VERSION" 46 | PACKAGE_VERSION="${PACKAGE_VERSION}-r$SVN_VERSION" 47 | VERSION="${VERSION}-r$SVN_VERSION" 48 | fi 49 | 50 | # Checks for header files. 51 | 52 | # Checks for typedefs, structures, and compiler characteristics. 53 | AM_OPTIONS_WXCONFIG 54 | AM_PATH_WXCONFIG(2.8.1, [have_wxconfig=1], [have_wxconfig=0], [std,gl,stc,aui, propgrid]) 55 | 56 | if test "$have_wxconfig" != 1; then 57 | AC_MSG_FAILURE([ 58 | wxWidgets detection failed, please set --with-wx* or add 59 | the libraries to your LDFLAGS, CXX/CFLAGS. 60 | ]) 61 | fi 62 | 63 | PKG_CHECK_MODULES(LIBAGG, libagg >= 2.5.0, [with_libagg=yes], [with_libagg=no]) 64 | 65 | if test "$with_libagg" != "yes"; then 66 | AC_MSG_FAILURE([You must have AGG installed: http://vector-agg.sourceforge.net/]) 67 | fi 68 | 69 | AC_OUTPUT([ 70 | Makefile 71 | src/wxAGG/Makefile 72 | src/xpm/Makefile 73 | src/Makefile 74 | ]) 75 | -------------------------------------------------------------------------------- /src/xpm/del__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *del__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 69 1", 5 | " c black", 6 | ". c #0C0C0C0C0C0C", 7 | "X c gray5", 8 | "o c gray9", 9 | "O c #191919191919", 10 | "+ c gray11", 11 | "@ c #262625252424", 12 | "# c #313131313131", 13 | "$ c #323232323232", 14 | "% c #353534343232", 15 | "& c #373735353333", 16 | "* c #373737373737", 17 | "= c #383838383737", 18 | "- c #3E3E3E3E3E3E", 19 | "; c #414141414141", 20 | ": c #575755555252", 21 | "> c #555555555555", 22 | ", c #5D5D5A5A5757", 23 | "< c gray35", 24 | "1 c gray36", 25 | "2 c #646464646464", 26 | "3 c gray42", 27 | "4 c #70706E6E6A6A", 28 | "5 c #71716F6F6B6B", 29 | "6 c #818181818181", 30 | "7 c #868686868686", 31 | "8 c #878787878686", 32 | "9 c #888888888787", 33 | "0 c #8F8F8C8C8787", 34 | "q c gray55", 35 | "w c #8F8F8E8E8D8D", 36 | "e c #979793938D8D", 37 | "r c gray57", 38 | "t c #969695959292", 39 | "y c gray59", 40 | "u c #9F9F9F9F9F9F", 41 | "i c #A3A39F9F9999", 42 | "p c #A0A0A0A0A0A0", 43 | "a c gray64", 44 | "s c #AAAAA6A6A0A0", 45 | "d c #AEAEACACA7A7", 46 | "f c #A9A9A9A9A9A9", 47 | "g c #B1B1AEAEA7A7", 48 | "h c #B3B3B0B0A9A9", 49 | "j c #B7B7B4B4ADAD", 50 | "k c #B9B9B7B7B1B1", 51 | "l c #BEBEBBBBB5B5", 52 | "z c #BCBCBCBCBCBC", 53 | "x c #C2C2BFBFB8B8", 54 | "c c #C3C3C0C0B8B8", 55 | "v c #C3C3C0C0B9B9", 56 | "b c #C7C7C3C3BBBB", 57 | "n c #C6C6C3C3BCBC", 58 | "m c gray78", 59 | "M c #CBCBC8C8C0C0", 60 | "N c #CFCFCBCBC4C4", 61 | "B c #C8C8C8C8C8C8", 62 | "V c gray80", 63 | "C c #D2D2CECEC6C6", 64 | "Z c #D3D3CFCFC7C7", 65 | "A c #D0D0D0D0D0D0", 66 | "S c LightGray", 67 | "D c gray86", 68 | "F c #DDDDDDDDDDDD", 69 | "G c gray90", 70 | "H c gray93", 71 | "J c #F4F4F4F4F4F4", 72 | "K c #F6F6F6F6F6F6", 73 | "L c None", 74 | /* pixels */ 75 | "LLLLN*LLLLLLLLLL", 76 | "LLLLk=0LLLLLLLLL", 77 | "LLLZt &LLLLLLLLL", 78 | "LLLv9<-iLLLLLLLL", 79 | "LLZtB1p%LL L", 80 | "LLlyH1F$eLLLLLLL", 81 | "LCwAH1Ff@cLLLLLL", 82 | "LdaJHuFS>5LLLLLL", 83 | "n8KJH FSm+sLLLLL", 84 | "LrqJHDFS3:xLLLLL", 85 | "Lb#DHGFzohLLLLLL", 86 | "LL46HGF2,LLLLLLL", 87 | "LLgOHGF LLLLLLLL", 88 | "LLX..X...LLLLLLL", 89 | "LLM;V7.XjLLLLLLL" 90 | }; 91 | -------------------------------------------------------------------------------- /src/agg_conv_bcspline.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_conv_bcspline_INCLUDED 26 | #define AGG_conv_bcspline_INCLUDED 27 | 28 | #include "agg_basics.h" 29 | #include "agg_vcgen_bcspline.h" 30 | #include "agg_conv_adaptor_vcgen.h" 31 | 32 | 33 | namespace agg 34 | { 35 | 36 | //---------------------------------------------------------conv_bcspline 37 | template 38 | struct conv_bcspline : public conv_adaptor_vcgen 39 | { 40 | typedef conv_adaptor_vcgen base_type; 41 | 42 | conv_bcspline(VertexSource& vs) : 43 | conv_adaptor_vcgen(vs) {} 44 | 45 | void interpolation_step(double v) { base_type::generator().interpolation_step(v); } 46 | double interpolation_step() const { return base_type::generator().interpolation_step(); } 47 | 48 | private: 49 | conv_bcspline(const conv_bcspline&); 50 | const conv_bcspline& 51 | operator = (const conv_bcspline&); 52 | }; 53 | 54 | } 55 | 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /src/xpm/pan_bg_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *pan_bg_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "24 15 66 1", 5 | " c #2A2A35354D4D", 6 | ". c #2C2C38384B4B", 7 | "X c #36364A4A6464", 8 | "o c #474757576E6E", 9 | "O c #4D4D5C5C7272", 10 | "+ c #5E5E66667171", 11 | "@ c #606060606060", 12 | "# c #C1C14B4B2B2B", 13 | "$ c #CFCF55553636", 14 | "% c #CBCB75752424", 15 | "& c #BABA6D6D6666", 16 | "* c #CCCC69695656", 17 | "= c #C9C973736666", 18 | "- c #FFFF7F7F7F7F", 19 | "; c #EDEDA0A04C4C", 20 | ": c #EFEFA5A54F4F", 21 | "> c #585866668585", 22 | ", c #646475759696", 23 | "< c #7D7D89899E9E", 24 | "1 c #72728383A7A7", 25 | "2 c #80808A8A9D9D", 26 | "3 c #86868E8E9D9D", 27 | "4 c #89899999AFAF", 28 | "5 c #8A8A9A9AAEAE", 29 | "6 c #81819292BABA", 30 | "7 c #9696A3A3B4B4", 31 | "8 c #9D9DA7A7BBBB", 32 | "9 c #A3A3ABABBABA", 33 | "0 c #D3D396968D8D", 34 | "q c #D2D297978D8D", 35 | "w c #DDDDA5A59B9B", 36 | "e c #E8E8C3C39393", 37 | "r c #83839999C7C7", 38 | "t c #9090A5A5C3C3", 39 | "y c #9191A5A5C3C3", 40 | "u c #9191A5A5C4C4", 41 | "i c #9292A6A6C5C5", 42 | "p c #9292A7A7C5C5", 43 | "a c #9191A5A5C6C6", 44 | "s c #9393A7A7C6C6", 45 | "d c #9393A7A7C7C7", 46 | "f c #9898A8A8C5C5", 47 | "g c #9898AAAAC5C5", 48 | "h c #9797A7A7C9C9", 49 | "j c #9595A8A8CFCF", 50 | "k c #9B9BB1B1DFDF", 51 | "l c #AAAAB4B4C7C7", 52 | "z c #D4D4C3C3D0D0", 53 | "x c #CDCDDADAE9E9", 54 | "c c #D2D2D8D8E2E2", 55 | "v c #D6D6DCDCE6E6", 56 | "b c #C8C8DADAFDFD", 57 | "n c #D2D2DDDDF0F0", 58 | "m c #D5D5DFDFF1F1", 59 | "M c #E1E1E5E5ECEC", 60 | "N c #F2F2E2E2E2E2", 61 | "B c #F5F5E5E5E2E2", 62 | "V c #F1F1E9E9ECEC", 63 | "C c #EBEBEFEFFBFB", 64 | "Z c #EFEFF5F5F9F9", 65 | "A c #F1F1F4F4FAFA", 66 | "S c #F2F2F5F5FCFC", 67 | "D c #FAFAFBFBFEFE", 68 | "F c #FDFDFEFEFEFE", 69 | "G c gray100", 70 | "H c None", 71 | /* pixels */ 72 | "HHHHH@HHHHHHHHHHHHHHHHHH", 73 | "HHHHH@HHHHHHHHHHHHHHHHHH", 74 | "HHHHH@HHHHHHHHHHHHHHHHHH", 75 | "HHHHH@HHHHHHassdssyyygHH", 76 | "H@@@@@@@@@HHsGFGABw0VXHH", 77 | "H@HHH@---@HHiGGAAqe:&XHH", 78 | "H@HHH@---@HHsGGZZ=;%#XHH", 79 | "H@HHH@---@HHpGGvxN*$zXHH", 80 | "H@HHH@---@HHiGc4.XHH", 84 | "H@HHHHHHH@HHyXXXXXXXXXHH", 85 | "H@HHHHHHH@HHHHHHHHHHHHHH", 86 | "H@@@@@@@@@HHHHHHHHHHHHHH" 87 | }; 88 | -------------------------------------------------------------------------------- /src/canvas_mouse.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include "canvas_mouse.hpp" 29 | #include "canvas.hpp" 30 | 31 | DEFINE_EVENT_TYPE( wxEVT_MOUSEONCANVAS ) 32 | 33 | 34 | ASSDrawMouseOnCanvasEvent::ASSDrawMouseOnCanvasEvent(const ASSDrawCanvas* canvas) 35 | : wxNotifyEvent(), 36 | _canvas(canvas) 37 | { 38 | _data = NULL; 39 | } 40 | 41 | wxEvent* ASSDrawMouseOnCanvasEvent::Clone() 42 | { 43 | ASSDrawMouseOnCanvasEvent *clone = new ASSDrawMouseOnCanvasEvent(_canvas); 44 | clone->SetData(_data); 45 | return clone; 46 | } 47 | 48 | void ASSDrawMouseOnCanvasEvent::SetData(MouseOnCanvasData *data) 49 | { 50 | _data = data; 51 | } 52 | 53 | MouseOnCanvasData* ASSDrawMouseOnCanvasEvent::GetData() 54 | { 55 | return _data; 56 | } 57 | -------------------------------------------------------------------------------- /src/xpm/preview__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *preview__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 79 1", 5 | " c gray20", 6 | ". c #353535353535", 7 | "X c gray21", 8 | "o c gray22", 9 | "O c gray23", 10 | "+ c #3C3C3C3C3C3C", 11 | "@ c #3E3E3E3E3E3E", 12 | "# c #3F3F3F3F3F3F", 13 | "$ c gray25", 14 | "% c #414141414141", 15 | "& c gray26", 16 | "* c #434343434343", 17 | "= c gray27", 18 | "- c #464646464646", 19 | "; c #484848484848", 20 | ": c #494949494949", 21 | "> c gray29", 22 | ", c #4B4B4B4B4B4B", 23 | "< c #4C4C4C4C4C4C", 24 | "1 c gray30", 25 | "2 c #505050505050", 26 | "3 c gray32", 27 | "4 c gray33", 28 | "5 c #555555555555", 29 | "6 c #565656565656", 30 | "7 c gray34", 31 | "8 c gray35", 32 | "9 c #5A5A5A5A5A5A", 33 | "0 c #5B5B5B5B5B5B", 34 | "q c #5D5D5D5D5D5D", 35 | "w c #676767676767", 36 | "e c #6D6D6D6D6D6D", 37 | "r c gray43", 38 | "t c #6F6F6F6F6F6F", 39 | "y c gray44", 40 | "u c #727272727272", 41 | "i c gray46", 42 | "p c #777777777777", 43 | "a c gray47", 44 | "s c #7B7B7B7B7B7B", 45 | "d c gray49", 46 | "f c #7E7E7E7E7E7E", 47 | "g c #808080808080", 48 | "h c #848484848484", 49 | "j c #898989898989", 50 | "k c gray54", 51 | "l c #8B8B8B8B8B8B", 52 | "z c gray55", 53 | "x c #8D8D8D8D8D8D", 54 | "c c #909090909090", 55 | "v c gray57", 56 | "b c gray58", 57 | "n c gray59", 58 | "m c #979797979797", 59 | "M c #9A9A9A9A9A9A", 60 | "N c #9B9B9B9B9B9B", 61 | "B c #9D9D9D9D9D9D", 62 | "V c #9F9F9F9F9F9F", 63 | "C c #A0A0A0A0A0A0", 64 | "Z c gray63", 65 | "A c gray64", 66 | "S c #A4A4A4A4A4A4", 67 | "D c #A5A5A5A5A5A5", 68 | "F c gray65", 69 | "G c #A7A7A7A7A7A7", 70 | "H c #A9A9A9A9A9A9", 71 | "J c gray67", 72 | "K c #ACACACACACAC", 73 | "L c gray68", 74 | "P c #AEAEAEAEAEAE", 75 | "I c #B4B4B4B4B4B4", 76 | "U c gray71", 77 | "Y c #B9B9B9B9B9B9", 78 | "T c gray73", 79 | "R c #BBBBBBBBBBBB", 80 | "E c gray74", 81 | "W c gray", 82 | "Q c gray75", 83 | "! c None", 84 | /* pixels */ 85 | "!!!!!!!!d.6Q!!!!", 86 | "!!!!!!!coI4j!!!!", 87 | "!!!r,51%P!zq!E!!", 88 | "!!B*DCAW!!F@a$&S", 89 | "!!V:!!!!!!QguJk6", 90 | "!!!-m!!!!!!!!!k0", 91 | "!!!st!!!!!!!!sXG", 92 | "!!Y+n!!!!!!l*5K!", 93 | "!R=f!!!!!!x#N!!!", 94 | "!5t!!!!!!!wp!!!!", 95 | "N+!!!!!!!!HoM!!!", 96 | "8l!!!y5t!!!ZO!!!", 97 | "3n!!99G2h!!b!!L RU.B!!!", 99 | "!h>7T!!!i;=f!!!!" 100 | }; 101 | -------------------------------------------------------------------------------- /src/xpm/pan_both_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *pan_both_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "24 15 76 1", 5 | " c #1B1B22225353", 6 | ". c #0D0D0D0D6767", 7 | "X c #0F0F14146161", 8 | "o c #111115156464", 9 | "O c #121219196262", 10 | "+ c #131313136969", 11 | "@ c #131314146C6C", 12 | "# c #111115156F6F", 13 | "$ c #19191A1A6E6E", 14 | "% c #1E1E1E1E6F6F", 15 | "& c #1D1D21217878", 16 | "* c #232330306262", 17 | "= c #282837376262", 18 | "- c #2A2A2A2A7575", 19 | "; c #3C3C3C3C7E7E", 20 | ": c #36364A4A6464", 21 | "> c #606060606060", 22 | ", c #C1C14B4B2B2B", 23 | "< c #CFCF55553636", 24 | "1 c #CBCB75752424", 25 | "2 c #BABA6D6D6666", 26 | "3 c #CCCC69695656", 27 | "4 c #C9C973736666", 28 | "5 c #FFFF7F7F7F7F", 29 | "6 c #EDEDA0A04C4C", 30 | "7 c #EFEFA5A54F4F", 31 | "8 c #484848488484", 32 | "9 c #5A5A5A5A8E8E", 33 | "0 c #45454B4B9696", 34 | "q c #5F5F5F5F9090", 35 | "w c #656565659292", 36 | "e c #777777779B9B", 37 | "r c #7E7E7E7E9F9F", 38 | "t c #B2B20000FFFF", 39 | "y c #7D7D89899E9E", 40 | "u c #7B7B8888B1B1", 41 | "i c #83838383A1A1", 42 | "p c #89899999AFAF", 43 | "a c #8A8A9A9AAEAE", 44 | "s c #9B9B9B9BADAD", 45 | "d c #9696A3A3B4B4", 46 | "f c #A1A1A1A1B0B0", 47 | "g c #A7A7A7A7B3B3", 48 | "h c #B9B9B9B9BCBC", 49 | "j c #D3D396968D8D", 50 | "k c #D2D297978D8D", 51 | "l c #DDDDA5A59B9B", 52 | "z c #E8E8C3C39393", 53 | "x c #9090A5A5C3C3", 54 | "c c #9191A5A5C3C3", 55 | "v c #9191A5A5C4C4", 56 | "b c #9292A6A6C5C5", 57 | "n c #9292A7A7C5C5", 58 | "m c #9191A5A5C6C6", 59 | "M c #9393A7A7C6C6", 60 | "N c #9393A7A7C7C7", 61 | "B c #9898AAAAC5C5", 62 | "V c #9595A8A8CFCF", 63 | "C c #AAAAB3B3D4D4", 64 | "Z c #D4D4C3C3D0D0", 65 | "A c #C0C0CACAE3E3", 66 | "S c #CDCDDADAE9E9", 67 | "D c #D2D2D8D8E2E2", 68 | "F c #D6D6DCDCE6E6", 69 | "G c #E1E1E5E5ECEC", 70 | "H c #F2F2E2E2E2E2", 71 | "J c #F5F5E5E5E2E2", 72 | "K c #F1F1E9E9ECEC", 73 | "L c #EBEBEFEFFBFB", 74 | "P c #EFEFF5F5F9F9", 75 | "I c #F1F1F4F4FAFA", 76 | "U c #F2F2F5F5FCFC", 77 | "Y c #FAFAFBFBFEFE", 78 | "T c #FDFDFEFEFEFE", 79 | "R c gray100", 80 | "E c None", 81 | /* pixels */ 82 | "EEEEE>EEEEEmMMNMMcccBEEE", 83 | "EEEEE>EEEEEMRTRIJljK:EEE", 84 | "EEEEE>EEEEEbRRIIkz72:EEE", 85 | "EEEEE>EEEEEMRRPP461,:EEE", 86 | "E>>>>>>>>>EnRRFSH3EEE>555>EbRDpyu$@0*EEE", 88 | "E>EEE>555>EvGaUCott O%sE", 89 | "E>EEE>555>EvdYA&tttttt-f", 90 | "E>EEE>555>ExLV#tttttttt+", 91 | "E>>>>>>>>>Ec::=Xttttttw9", 92 | "E>EEEEEEE>EEEEEe8ttttt-h", 93 | "E>EEEEEEE>EEEEEE9wttt-sE", 94 | "E>EEEEEEE>EEEEEEE;itqqEE", 95 | "E>EEEEEEE>EEEEEEEh-r-hEE", 96 | "E>>>>>>>>>EEEEEEEEg.fEEE" 97 | }; 98 | -------------------------------------------------------------------------------- /src/xpm/rot__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *rot__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 81 1", 5 | " c #62625858C4C4", 6 | ". c #62625959C4C4", 7 | "X c #64645A5AC4C4", 8 | "o c #65655B5BC4C4", 9 | "O c #65655B5BC5C5", 10 | "+ c #66665C5CC4C4", 11 | "@ c #66665D5DC5C5", 12 | "# c #67675D5DC5C5", 13 | "$ c #67675E5EC5C5", 14 | "% c #68685E5EC5C5", 15 | "& c #69695F5FC5C5", 16 | "* c #69696060C6C6", 17 | "= c #6A6A6161C6C6", 18 | "- c #6E6E6565C7C7", 19 | "; c #6F6F6767C7C7", 20 | ": c #73736A6AC7C7", 21 | "> c #77776E6EC7C7", 22 | ", c #73736A6AC8C8", 23 | "< c #73736B6BC8C8", 24 | "1 c #74746B6BC8C8", 25 | "2 c #76766D6DC8C8", 26 | "3 c #7D7D7474C9C9", 27 | "4 c #7E7E7575C9C9", 28 | "5 c #7E7E7676C9C9", 29 | "6 c #7E7E7676CBCB", 30 | "7 c #7F7F7676CBCB", 31 | "8 c #80807777CACA", 32 | "9 c #81817878CBCB", 33 | "0 c #81817979CDCD", 34 | "q c #82827A7ACCCC", 35 | "w c #87877F7FCCCC", 36 | "e c #88887F7FCCCC", 37 | "r c #88888080CDCD", 38 | "t c #8E8E8686CDCD", 39 | "y c #91918989CFCF", 40 | "u c #93938A8ACECE", 41 | "i c #92928A8ACFCF", 42 | "p c #96968E8ECECE", 43 | "a c #92928B8BD0D0", 44 | "s c #A1A19999D0D0", 45 | "d c #A3A39B9BD3D3", 46 | "f c #A4A49D9DD3D3", 47 | "g c #A5A59E9ED2D2", 48 | "h c #A7A79F9FD3D3", 49 | "j c #A3A39D9DD4D4", 50 | "k c #A4A49D9DD4D4", 51 | "l c #A6A69E9ED5D5", 52 | "z c #A7A7A0A0D4D4", 53 | "x c #ABABA4A4D2D2", 54 | "c c #A8A8A1A1D5D5", 55 | "v c #A9A9A2A2D4D4", 56 | "b c #AAAAA3A3D7D7", 57 | "n c #A7A7A0A0D8D8", 58 | "m c #B1B1ABABD5D5", 59 | "M c #B7B7B0B0D7D7", 60 | "N c #BABAB3B3D7D7", 61 | "B c #BBBBB5B5D5D5", 62 | "V c #BFBFB9B9D6D6", 63 | "C c #BFBFBABAD9D9", 64 | "Z c #C3C3BDBDDADA", 65 | "A c #C2C2BDBDDEDE", 66 | "S c #C4C4BFBFDCDC", 67 | "D c #C5C5C0C0DCDC", 68 | "F c #C7C7C2C2DEDE", 69 | "G c #C8C8C2C2DADA", 70 | "H c #CACAC5C5D8D8", 71 | "J c #C9C9C4C4DADA", 72 | "K c #CBCBC6C6DBDB", 73 | "L c #CCCCC7C7DFDF", 74 | "P c #D1D1CCCCDCDC", 75 | "I c #D4D4CFCFDEDE", 76 | "U c #D6D6D1D1DDDD", 77 | "Y c #D0D0CACAE1E1", 78 | "T c #D2D2CCCCE1E1", 79 | "R c #D4D4CFCFE0E0", 80 | "E c #D3D3CECEE4E4", 81 | "W c #D6D6D1D1E1E1", 82 | "Q c #D8D8D3D3E1E1", 83 | "! c #D8D8D2D2E3E3", 84 | "~ c #DBDBD7D7E5E5", 85 | "^ c None", 86 | /* pixels */ 87 | "^^^^^^^^^^^^^^^^", 88 | "^^En0&+^^^^^^^^^", 89 | "^A9O ~^^^^^^^^", 90 | "TqO7bY^^^^^^!^^^", 91 | "c*6L^^^^^^^WkF^^", 92 | "rOl^^^^^^^WjpV^^^^^", 101 | "^^^^^^^^^^^^^^^^" 102 | }; 103 | -------------------------------------------------------------------------------- /src/wxAGG/AGGWindow.h: -------------------------------------------------------------------------------- 1 | #ifndef WX_AGG_WINDOW_H 2 | #define WX_AGG_WINDOW_H 3 | 4 | #include "PixelFormatConvertor.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "agg_rendering_buffer.h" 12 | 13 | namespace GUI { 14 | 15 | /// A simple widget that displays a bitmap that AGG can draw on. 16 | /// It reallocates the bitmap so that it always is the current size of the 17 | /// entire panel and calls the virtual method draw() to draw to the bitmap. 18 | /// This should be useable anywhere a wxWindow can be, e.g. in actual windows, 19 | /// buttons, etc. 20 | class AGGWindow: public wxWindow { 21 | public: 22 | /// Create an AGGWindow. Defaults are taken from wxWindow::wxWindow(), see 23 | /// that documentation for more information. 24 | AGGWindow(wxWindow* parent, wxWindowID id = wxID_ANY, 25 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 26 | long style = wxTAB_TRAVERSAL); 27 | 28 | /// Clean up resources held 29 | virtual ~AGGWindow(); 30 | 31 | protected: 32 | 33 | /// The conversion between wxWidgets' pixel format and AGG's pixel format 34 | typedef PixelFormatConvertor PixelFormat; 35 | 36 | /// The wxWidgets "pixel data" type, an accessor to the raw pixels 37 | typedef wxPixelData PixelData; 38 | 39 | 40 | /// Create the bitmap given the current size. 41 | void init(const int width, const int height); 42 | 43 | /// Attach the AGG rendering buffer to the bitmap and call the user draw() code. 44 | void attachAndDraw(); 45 | 46 | /// Paint the bitmap onto the panel. 47 | void onPaint(wxPaintEvent& event); 48 | 49 | /// Resize the bitmap to match the window. 50 | void onSize(wxSizeEvent& event); 51 | 52 | /// Handle the erase-background event. 53 | void onEraseBackground(wxEraseEvent& event); 54 | 55 | /// Draw into the bitmap using AGG. 56 | virtual void draw() = 0; 57 | 58 | 59 | wxBitmap* bitmap; ///< wxWidgets bitmap for AGG to draw into 60 | wxMemoryDC memDC; ///< Memory "device context" for drawing the bitmap 61 | 62 | agg::rendering_buffer rBuf; ///< AGG's rendering buffer, pointing into the bitmap 63 | 64 | DECLARE_EVENT_TABLE() /// Allocate wxWidgets storage for event handlers 65 | }; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/xpm/del_cross_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *delcross_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 85 1", 5 | " c #3F3F14141818", 6 | ". c #4C4C19192121", 7 | "X c #656522222626", 8 | "o c #797927272C2C", 9 | "O c #6E6E24243333", 10 | "+ c #82822A2A2D2D", 11 | "@ c #919130303434", 12 | "# c #949431313535", 13 | "$ c #979732323434", 14 | "% c #979732323B3B", 15 | "& c #9E9E35353D3D", 16 | "* c #9E9E34343F3F", 17 | "= c #A0A036363939", 18 | "- c #A5A538383C3C", 19 | "; c #A7A73A3A3E3E", 20 | ": c #ACAC3B3B3E3E", 21 | "> c #B5B53D3D3D3D", 22 | ", c #9E9E34344848", 23 | "< c #A5A539394242", 24 | "1 c #AEAE3D3D4040", 25 | "2 c #A3A337374D4D", 26 | "3 c #B7B73F3F4343", 27 | "4 c #B3B33F3F4747", 28 | "5 c #B5B53F3F4545", 29 | "6 c #B3B33C3C5353", 30 | "7 c #B1B13D3D5454", 31 | "8 c #B3B33C3C5656", 32 | "9 c #B5B53D3D5959", 33 | "0 c #B7B740404141", 34 | "q c #BDBD42424545", 35 | "w c #B7B741414848", 36 | "e c #B3B340405C5C", 37 | "r c #BFBF45455E5E", 38 | "t c #C3C345454C4C", 39 | "y c #D0D04B4B5252", 40 | "u c #C9C948486666", 41 | "i c #CFCF4B4B6868", 42 | "p c #D0D04C4C6A6A", 43 | "a c #D2D24C4C6C6C", 44 | "s c #E4E457577575", 45 | "d c #E2E258587676", 46 | "f c #E7E75B5B7979", 47 | "g c #EAEA5B5B7A7A", 48 | "h c #E8E85C5C7979", 49 | "j c #EAEA5C5C7A7A", 50 | "k c #F1F160607B7B", 51 | "l c #F1F162627F7F", 52 | "z c #F4F464648080", 53 | "x c #F6F666668080", 54 | "c c #F5F564648282", 55 | "v c #F7F766668585", 56 | "b c #FAFA69698484", 57 | "n c #FFFF6D6D8686", 58 | "m c #FCFC6B6B8888", 59 | "M c #FFFF6D6D8989", 60 | "N c #FFFF6F6F8B8B", 61 | "B c #FFFF71718989", 62 | "V c #FFFF74748F8F", 63 | "C c #FFFF83839B9B", 64 | "Z c #FFFF89899B9B", 65 | "A c #FFFF89899D9D", 66 | "S c #FFFF8D8DA2A2", 67 | "D c #FFFF9393A5A5", 68 | "F c #FFFF9595A6A6", 69 | "G c #FFFF9E9EA7A7", 70 | "H c #FFFFA6A6ABAB", 71 | "J c #FFFFA5A5B1B1", 72 | "K c #FFFFAFAFB1B1", 73 | "L c #FFFFADADB4B4", 74 | "P c #FFFFB0B0B2B2", 75 | "I c #FFFFB0B0B9B9", 76 | "U c #FFFFB5B5B8B8", 77 | "Y c #FFFFB4B4BCBC", 78 | "T c #FFFFBBBBBBBB", 79 | "R c #FFFFBCBCBBBB", 80 | "E c #FFFFB8B8BDBD", 81 | "W c #FFFFC0C0BEBE", 82 | "Q c #FFFFC0C0C2C2", 83 | "! c #FFFFC4C4C2C2", 84 | "~ c #FFFFC3C3C4C4", 85 | "^ c #FFFFC4C4C7C7", 86 | "/ c #FFFFC7C7C6C6", 87 | "( c #FFFFC7C7C7C7", 88 | ") c #FFFFCCCCC9C9", 89 | "_ c None", 90 | /* pixels */ 91 | "_^jY____________", 92 | "_DqtJ________S__", 93 | "_Fh;5C_____Iym__", 94 | "__Eg10l___c4V___", 95 | "____Aw3vQN>M____", 96 | "_____~p-& vertex_storage; 50 | 51 | vcgen_bcspline(); 52 | 53 | void interpolation_step(double v) { m_interpolation_step = v; } 54 | double interpolation_step() const { return m_interpolation_step; } 55 | 56 | // Vertex Generator Interface 57 | void remove_all(); 58 | void add_vertex(double x, double y, unsigned cmd); 59 | 60 | // Vertex Source Interface 61 | void rewind(unsigned path_id); 62 | unsigned vertex(double* x, double* y); 63 | 64 | private: 65 | vcgen_bcspline(const vcgen_bcspline&); 66 | const vcgen_bcspline& operator = (const vcgen_bcspline&); 67 | 68 | vertex_storage m_src_vertices; 69 | bcspline m_spline_x; 70 | bcspline m_spline_y; 71 | double m_interpolation_step; 72 | unsigned m_closed; 73 | status_e m_status; 74 | unsigned m_src_vertex; 75 | double m_cur_abscissa; 76 | double m_max_abscissa; 77 | }; 78 | 79 | } 80 | 81 | 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /src/ASSDraw3.layout: -------------------------------------------------------------------------------- 1 | [Editor_10] 2 | CursorCol=32 3 | CursorRow=553 4 | TopLine=535 5 | LeftChar=1 6 | Open=1 7 | Top=0 8 | [Editor_7] 9 | CursorCol=6 10 | CursorRow=227 11 | TopLine=197 12 | LeftChar=1 13 | Open=1 14 | Top=1 15 | [Editor_5] 16 | CursorCol=11 17 | CursorRow=19 18 | TopLine=1 19 | LeftChar=1 20 | Open=1 21 | Top=0 22 | [Editor_18] 23 | CursorCol=11 24 | CursorRow=14 25 | TopLine=1 26 | LeftChar=1 27 | Open=0 28 | Top=0 29 | [Editor_19] 30 | CursorCol=12 31 | CursorRow=3 32 | TopLine=3 33 | LeftChar=1 34 | Open=0 35 | Top=0 36 | [Editor_11] 37 | CursorCol=8 38 | CursorRow=44 39 | TopLine=31 40 | LeftChar=1 41 | Open=0 42 | Top=0 43 | [Editor_3] 44 | CursorCol=1 45 | CursorRow=268 46 | TopLine=243 47 | LeftChar=1 48 | Open=1 49 | Top=0 50 | [Editor_15] 51 | CursorCol=15 52 | CursorRow=7 53 | TopLine=1 54 | LeftChar=1 55 | Open=1 56 | Top=0 57 | [Editor_8] 58 | CursorCol=1 59 | CursorRow=69 60 | TopLine=33 61 | LeftChar=1 62 | Open=0 63 | Top=0 64 | [Editor_16] 65 | CursorCol=2 66 | CursorRow=25 67 | TopLine=1 68 | LeftChar=1 69 | Open=0 70 | Top=0 71 | [Editor_0] 72 | CursorCol=39 73 | CursorRow=212 74 | TopLine=184 75 | LeftChar=1 76 | Open=1 77 | Top=0 78 | [Editors] 79 | Focused=7 80 | Order=5,0,10,17,3,6,7,22,21,20,15 81 | [Editor_1] 82 | Open=0 83 | Top=0 84 | CursorCol=21 85 | CursorRow=63 86 | TopLine=30 87 | LeftChar=1 88 | [Editor_2] 89 | Open=0 90 | Top=0 91 | CursorCol=7 92 | CursorRow=83 93 | TopLine=50 94 | LeftChar=1 95 | [Editor_4] 96 | Open=0 97 | Top=0 98 | CursorCol=19 99 | CursorRow=21 100 | TopLine=21 101 | LeftChar=1 102 | [Editor_6] 103 | Open=1 104 | Top=0 105 | CursorCol=1 106 | CursorRow=577 107 | TopLine=556 108 | LeftChar=1 109 | [Editor_9] 110 | Open=0 111 | Top=0 112 | CursorCol=1 113 | CursorRow=1 114 | TopLine=1 115 | LeftChar=1 116 | [Editor_12] 117 | Open=0 118 | Top=0 119 | CursorCol=6 120 | CursorRow=99 121 | TopLine=91 122 | LeftChar=1 123 | [Editor_13] 124 | Open=0 125 | Top=0 126 | CursorCol=1 127 | CursorRow=204 128 | TopLine=170 129 | LeftChar=1 130 | [Editor_14] 131 | Open=0 132 | Top=0 133 | CursorCol=1 134 | CursorRow=290 135 | TopLine=256 136 | LeftChar=1 137 | [Editor_17] 138 | Open=1 139 | Top=0 140 | CursorCol=68 141 | CursorRow=133 142 | TopLine=112 143 | LeftChar=1 144 | [Editor_20] 145 | Open=1 146 | Top=0 147 | CursorCol=46 148 | CursorRow=195 149 | TopLine=163 150 | LeftChar=1 151 | [Editor_21] 152 | Open=1 153 | Top=0 154 | CursorCol=2 155 | CursorRow=58 156 | TopLine=57 157 | LeftChar=1 158 | [Editor_22] 159 | Open=1 160 | Top=0 161 | CursorCol=32 162 | CursorRow=160 163 | TopLine=129 164 | LeftChar=1 165 | [Editor_23] 166 | Open=0 167 | Top=0 168 | CursorCol=2 169 | CursorRow=6 170 | TopLine=1 171 | LeftChar=1 172 | [Editor_24] 173 | CursorCol=1 174 | CursorRow=56 175 | TopLine=25 176 | LeftChar=1 177 | Open=0 178 | Top=0 179 | [Editor_25] 180 | Open=0 181 | Top=0 182 | CursorCol=18 183 | CursorRow=8 184 | TopLine=1 185 | LeftChar=1 186 | -------------------------------------------------------------------------------- /src/canvas_mouse.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include "_common.hpp" 31 | #include "enums.hpp" 32 | #include "engine.hpp" 33 | 34 | #include 35 | 36 | struct MouseOnCanvasData 37 | { 38 | MODE mode; 39 | wxMouseEvent event; 40 | enum { NONE, LEFT, RIGHT, BOTH } button; 41 | 42 | Point* mousedownAt_point; 43 | Point* pointedAt_point; 44 | Point* dblclicked_point_right; 45 | 46 | wxPoint mouse_point; 47 | wxPoint* dragAnchor_left; 48 | wxPoint* lastDrag_left; 49 | wxPoint* dragAnchor_right; 50 | wxPoint* lastDrag_right; 51 | }; 52 | 53 | class ASSDrawCanvas; 54 | 55 | class ASSDrawMouseOnCanvasEvent : public wxNotifyEvent 56 | { 57 | public: 58 | ASSDrawMouseOnCanvasEvent(const ASSDrawCanvas* canvas); 59 | 60 | wxEvent* Clone(); 61 | 62 | void SetData(MouseOnCanvasData *data); 63 | 64 | MouseOnCanvasData* GetData(); 65 | 66 | private: 67 | const ASSDrawCanvas* _canvas; 68 | MouseOnCanvasData* _data; 69 | 70 | }; 71 | 72 | DECLARE_EVENT_TYPE( wxEVT_MOUSEONCANVAS, -1 ) 73 | 74 | typedef void (wxEvtHandler::*wxMouseOnCanvasEventFunction)(ASSDrawMouseOnCanvasEvent&); 75 | 76 | #define EVT_MOUSEONCANVAS(fn) \ 77 | DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEONCANVAS, -1, -1, \ 78 | (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \ 79 | wxStaticCastEvent( wxMouseOnCanvasEventFunction, & fn ), (wxObject *) NULL ), 80 | 81 | class ASSDrawMouseOnCanvasHandler 82 | { 83 | 84 | 85 | }; 86 | -------------------------------------------------------------------------------- /src/agg_bcspline.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #ifndef AGG_bcspline_INCLUDED 26 | #define AGG_bcspline_INCLUDED 27 | 28 | #include "agg_array.h" 29 | 30 | namespace agg 31 | { 32 | //----------------------------------------------------------------bcspline 33 | // A very simple class of Bi-cubic Spline interpolation. 34 | // First call init(num, x[], y[]) where num - number of source points, 35 | // x, y - arrays of X and Y values respectively. Here Y must be a function 36 | // of X. It means that all the X-coordinates must be arranged in the ascending 37 | // order. 38 | // Then call get(x) that calculates a value Y for the respective X. 39 | // The class supports extrapolation, i.e. you can call get(x) where x is 40 | // outside the given with init() X-range. Extrapolation is a simple linear 41 | // function. 42 | // 43 | // See Implementation agg_bcspline.cpp 44 | //------------------------------------------------------------------------ 45 | class bcspline 46 | { 47 | public: 48 | bcspline(); 49 | bcspline(int num); 50 | bcspline(int num, const double* x, const double* y); 51 | 52 | void init(int num); 53 | void add_point(double x, double y); 54 | void prepare(); 55 | 56 | void init(int num, const double* x, const double* y); 57 | 58 | double get(double x) const; 59 | double get_stateful(double x) const; 60 | 61 | private: 62 | bcspline(const bcspline&); 63 | const bcspline& operator = (const bcspline&); 64 | 65 | static void bsearch(int n, const double *x, double x0, int *i); 66 | double extrapolation_left(double x) const; 67 | double extrapolation_right(double x) const; 68 | double interpolation(double x, int i) const; 69 | 70 | int m_max; 71 | int m_num; 72 | double* m_x; 73 | double* m_y; 74 | pod_array m_am; 75 | mutable int m_last_idx; 76 | }; 77 | 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/library.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include "engine.hpp" 31 | #include 32 | 33 | class ASSDrawFrame; 34 | class ASSDrawShapeLibrary; 35 | 36 | enum LIBLAYOUT { VERTICAL, HORIZONTAL }; 37 | 38 | enum { 39 | MENU_RANGE_START = 450, 40 | MENU_LOAD, 41 | MENU_COPYCLIPBOARD, 42 | MENU_SAVECANVAS, 43 | MENU_DELETE, 44 | MENU_RANGE_END, 45 | TOOL_SAVE, 46 | TOOL_CHECK, 47 | TOOL_UNCHECK, 48 | TOOL_DELETE 49 | }; 50 | 51 | class ASSDrawShapePreview : public ASSDrawEngine 52 | { 53 | protected: 54 | ASSDrawShapePreview( wxWindow *parent, ASSDrawShapeLibrary *shapelib, wxString initialcmds = _T("")); 55 | virtual void OnSize(wxSizeEvent& event); 56 | 57 | ASSDrawShapeLibrary *shapelib; 58 | wxCheckBox *cb; 59 | DECLARE_EVENT_TABLE() 60 | friend class ASSDrawShapeLibrary; 61 | }; 62 | 63 | class ASSDrawShapeLibrary : public wxScrolledWindow 64 | { 65 | public: 66 | ASSDrawShapeLibrary( wxWindow *parent, ASSDrawFrame *frame ); 67 | virtual ASSDrawShapePreview* AddShapePreview(wxString cmds, bool addtotop = false); 68 | virtual void OnSize(wxSizeEvent& event); 69 | virtual void OnMouseLeftDClick(wxMouseEvent &event); 70 | virtual void OnMouseRightClick(wxMouseEvent &event); 71 | virtual void OnPopupMenuClicked(wxCommandEvent &event); 72 | virtual void SaveShapeFromCanvas(wxCommandEvent& WXUNUSED(event)); 73 | virtual void CheckUncheckAllPreviews(wxCommandEvent &event); 74 | virtual void DeleteChecked(wxCommandEvent& WXUNUSED(event)); 75 | virtual void UpdatePreviewDisplays(); 76 | virtual std::vector< ASSDrawShapePreview *> GetShapePreviews(); 77 | virtual void LoadToCanvas(ASSDrawShapePreview *preview); 78 | 79 | wxScrolledWindow* libarea; 80 | wxFlexGridSizer *libsizer; 81 | wxSizer* sizer; 82 | LIBLAYOUT layout; 83 | protected: 84 | ASSDrawFrame *m_frame; 85 | ASSDrawShapePreview *activepreview; 86 | 87 | DECLARE_EVENT_TABLE() 88 | }; 89 | -------------------------------------------------------------------------------- /src/enums.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | // enum for IDs of menus 31 | enum { 32 | MENU_DUMMY = 200, 33 | MENU_CLEAR, 34 | MENU_PREVIEW, 35 | MENU_TRANSFORM, 36 | MENU_LIBRARY, 37 | MENU_HELP, 38 | MENU_RESETPERSPECTIVE, 39 | MENU_SETTINGS, 40 | MENU_UNDO, 41 | MENU_REDO, 42 | MENU_PASTE, 43 | MENU_BGIMG_LOAD, 44 | MENU_BGIMG_ALPHA, 45 | MENU_BGIMG_REMOVE, 46 | MENU_RECENTER, 47 | MENU_TBAR, 48 | MENU_REPOS_TOPLEFT, 49 | MENU_REPOS_TOPRIGHT, 50 | MENU_REPOS_CENTER, 51 | MENU_REPOS_BOTLEFT, 52 | MENU_REPOS_BOTRIGHT, 53 | MENU_BGIMG_RECENTER, 54 | MENU_REPOS_BGTOPLEFT, 55 | MENU_REPOS_BGTOPRIGHT, 56 | MENU_REPOS_BGCENTER, 57 | MENU_REPOS_BGBOTLEFT, 58 | MENU_REPOS_BGBOTRIGHT, 59 | MENU_DRC_LNTOBEZ, 60 | MENU_DRC_C1CONTBEZ, 61 | MENU_DRC_BEZTOLN, 62 | MENU_DRC_MOVE00, 63 | MENU_TB_ALL, 64 | MENU_TB_NONE, 65 | MENU_TB_DOCK, 66 | MENU_TB_UNDOCK, 67 | MENU_TB_DRAW, 68 | MENU_TB_MODE, 69 | MENU_TB_BGIMG 70 | }; 71 | 72 | // enum for modes (i.e. create m, b, l etc or normal mode) 73 | // also use as tools IDs 74 | enum MODE 75 | { 76 | MODE_ARR = 100, 77 | MODE_M = 101, 78 | MODE_N = 102, 79 | MODE_L = 103, 80 | MODE_B = 104, 81 | MODE_S = 105, 82 | MODE_P = 106, 83 | MODE_C = 107, 84 | MODE_DEL = 108, 85 | MODE_SCALEROTATE = 109, 86 | MODE_NUT_BILINEAR = 110 87 | }; 88 | 89 | // enum for IDs of other tools on the toolbar 90 | enum { 91 | TB_CLEAR = 111, 92 | TB_EDITSRC = 112, 93 | TB_PREVIEW = 113, 94 | TB_TRANSFORM = 114, 95 | TB_HELP = 115, 96 | TB_ZOOMSLIDER = 116, 97 | TB_BGALPHA_SLIDER = 117 98 | }; 99 | 100 | enum DRAGMODETOOL 101 | { 102 | DRAG_DWG = 120, 103 | DRAG_BGIMG = 121, 104 | DRAG_BOTH = 122 105 | }; 106 | 107 | struct DRAGMODE 108 | { 109 | bool drawing; 110 | bool bgimg; 111 | DRAGMODE() { drawing = true, bgimg = false; } 112 | DRAGMODE(bool d, bool b) { drawing = d, bgimg = b; } 113 | }; 114 | -------------------------------------------------------------------------------- /src/assdraw.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Icon 27 | // 28 | 29 | // Icon with lowest ID value placed first to ensure application icon 30 | // remains consistent on all systems. 31 | APPICO ICON "tsukasa.ico" 32 | 33 | ///////////////////////////////////////////////////////////////////////////// 34 | // 35 | // Bitmap 36 | // 37 | 38 | ASSDRAW3_ BITMAP "bitmaps/assdraw3.bmp" 39 | NEW_ BITMAP "bitmaps/new_.bmp" 40 | SRC_ BITMAP "bitmaps/src_.bmp" 41 | PREVIEW_ BITMAP "bitmaps/preview_.bmp" 42 | ARR_ BITMAP "bitmaps/arr_.bmp" 43 | M_ BITMAP "bitmaps/m_.bmp" 44 | N_ BITMAP "bitmaps/n_.bmp" 45 | L_ BITMAP "bitmaps/l_.bmp" 46 | B_ BITMAP "bitmaps/b_.bmp" 47 | S_ BITMAP "bitmaps/s_.bmp" 48 | P_ BITMAP "bitmaps/p_.bmp" 49 | C_ BITMAP "bitmaps/c_.bmp" 50 | DEL_ BITMAP "bitmaps/del_.bmp" 51 | NUT_ BITMAP "bitmaps/nut_.bmp" 52 | SC_ROT_ BITMAP "bitmaps/sc_rot_.bmp" 53 | ROT_ BITMAP "bitmaps/rot_.bmp" 54 | HELP_ BITMAP "bitmaps/help_.bmp" 55 | TRANSFORM BITMAP "bitmaps/transform.bmp" 56 | PAN_SHP BITMAP "bitmaps/pan_shp.bmp" 57 | PAN_BG BITMAP "bitmaps/pan_bg.bmp" 58 | //PAN_BOTH BITMAP "bitmaps/pan_both.bmp" 59 | ADD BITMAP "bitmaps/add_.bmp" 60 | CHECK BITMAP "bitmaps/check_.bmp" 61 | UNCHECK BITMAP "bitmaps/uncheck_.bmp" 62 | DELCROSS BITMAP "bitmaps/del_cross.bmp" 63 | 64 | #ifdef APSTUDIO_INVOKED 65 | ///////////////////////////////////////////////////////////////////////////// 66 | // 67 | // TEXTINCLUDE 68 | // 69 | 70 | 1 TEXTINCLUDE 71 | BEGIN 72 | "resource.h\0" 73 | END 74 | 75 | 3 TEXTINCLUDE 76 | BEGIN 77 | "\r\n" 78 | END 79 | 80 | 2 TEXTINCLUDE 81 | BEGIN 82 | "#include ""afxres.h""\r\n" 83 | END 84 | 85 | #endif // APSTUDIO_INVOKED 86 | 87 | #endif // English (U.S.) resources 88 | ///////////////////////////////////////////////////////////////////////////// 89 | 90 | 91 | 92 | #ifndef APSTUDIO_INVOKED 93 | ///////////////////////////////////////////////////////////////////////////// 94 | // 95 | // Generated from the TEXTINCLUDE 3 resource. 96 | // 97 | 98 | 99 | ///////////////////////////////////////////////////////////////////////////// 100 | #endif // not APSTUDIO_INVOKED 101 | 102 | -------------------------------------------------------------------------------- /src/cmd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // Name: cmd.hpp 30 | // Purpose: header file for ASSDraw drawing command classes 31 | // Author: ai-chan 32 | // Created: 08/26/06 33 | // Copyright: (c) ai-chan 34 | // Licence: 3-clause BSD 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | #pragma once 38 | 39 | #include "engine.hpp" // include the engine header for DrawCmd 40 | #include // ok, we use vector too 41 | 42 | // this header file declares the following classes 43 | class DrawCmd_M; 44 | class DrawCmd_L; 45 | class DrawCmd_B; 46 | 47 | // The M command 48 | class DrawCmd_M: public DrawCmd 49 | { 50 | public: 51 | // Constructor 52 | DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev ); 53 | 54 | // to ASS drawing command 55 | wxString ToString(); 56 | 57 | }; 58 | 59 | // The L command 60 | class DrawCmd_L: public DrawCmd 61 | { 62 | public: 63 | // Constructor 64 | DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev ); 65 | 66 | // to ASS drawing command 67 | wxString ToString(); 68 | 69 | }; 70 | 71 | // The B command 72 | class DrawCmd_B: public DrawCmd 73 | { 74 | public: 75 | // Constructor 76 | DrawCmd_B ( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev ); 77 | 78 | // Special constructor where only m_point is defined 79 | // Need to call Init() to generate the controls 80 | DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev ); 81 | 82 | // Init this B command; generate controlpoints 83 | void Init ( unsigned n = 0 ); 84 | 85 | // to ASS drawing command 86 | wxString ToString(); 87 | 88 | //special 89 | bool C1Cont; 90 | 91 | }; 92 | 93 | // The S command 94 | class DrawCmd_S: public DrawCmd 95 | { 96 | public: 97 | // Constructor 98 | DrawCmd_S ( int x, int y, PointSystem *ps, DrawCmd *prev ); 99 | 100 | // Constructor (with points info) 101 | DrawCmd_S ( int x, int y, std::vector< int > vals, PointSystem *ps, DrawCmd *prev ); 102 | 103 | // Init this S command; generate controlpoints 104 | void Init ( unsigned n = 0 ); 105 | 106 | // to ASS drawing command 107 | wxString ToString(); 108 | 109 | // special 110 | bool closed; 111 | }; 112 | 113 | -------------------------------------------------------------------------------- /src/xpm/sc_rot__xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *sc_rot__xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "16 15 119 2", 5 | " c #212126264747", 6 | ". c #2B2B2B2B4848", 7 | "X c #363636364D4D", 8 | "o c #3B3B3B3B5C5C", 9 | "O c #141425256565", 10 | "+ c #0B0B27277D7D", 11 | "@ c #282828286262", 12 | "# c #373737376060", 13 | "$ c #363636366363", 14 | "% c #323232327878", 15 | "& c #3C3C4C4C5858", 16 | "* c #35354F4F6161", 17 | "= c #2F2F56567373", 18 | "- c #303055557070", 19 | "; c #404040405454", 20 | ": c #41414F4F5959", 21 | "> c #505050505050", 22 | ", c #505050505959", 23 | "< c #585858585858", 24 | "1 c #434343437F7F", 25 | "2 c #4B4B4B4B7979", 26 | "3 c #6F6F6F6F7676", 27 | "4 c #686868687D7D", 28 | "5 c gray44", 29 | "6 c gray47", 30 | "7 c #7C7C7C7C7C7C", 31 | "8 c #0B0B27279C9C", 32 | "9 c #202020208C8C", 33 | "0 c #16161C1CA0A0", 34 | "q c #00003737A0A0", 35 | "w c #00003737ACAC", 36 | "e c #0B0B2727BBBB", 37 | "r c #00003737B9B9", 38 | "t c #22222222A2A2", 39 | "y c #25252525A5A5", 40 | "u c #28282828A8A8", 41 | "i c #2F2F2F2FAFAF", 42 | "p c #35353535A2A2", 43 | "a c #37373737B7B7", 44 | "s c #3B3B3B3BBBBB", 45 | "d c #3E3E3E3EBEBE", 46 | "f c #181843438585", 47 | "g c #28285F5F8888", 48 | "h c #1F1F67679E9E", 49 | "j c #202062629595", 50 | "k c #242465659494", 51 | "l c #222267679A9A", 52 | "z c #222268689A9A", 53 | "x c #00004747B0B0", 54 | "c c #00005050B9B9", 55 | "v c #16167777BDBD", 56 | "b c #20206A6AA0A0", 57 | "n c #4B4B4B4B8686", 58 | "m c #474747478888", 59 | "M c #474747478D8D", 60 | "N c #474747478F8F", 61 | "B c #525252528D8D", 62 | "V c #474747479393", 63 | "C c #414141419595", 64 | "Z c #474747479494", 65 | "A c #474747479595", 66 | "S c #474747479A9A", 67 | "D c #474747479B9B", 68 | "F c #474747479C9C", 69 | "G c #5E5E5E5E9090", 70 | "H c #5E5E5E5E9292", 71 | "J c #696969698080", 72 | "K c #606060608A8A", 73 | "L c #6A6A6A6A9898", 74 | "P c #797979799696", 75 | "I c #757575759D9D", 76 | "U c #767676769E9E", 77 | "Y c #47474747A0A0", 78 | "T c #47474747A1A1", 79 | "R c #47474747A3A3", 80 | "E c #44444444A5A5", 81 | "W c #47474747A6A6", 82 | "Q c #47474747A7A7", 83 | "! c #47474747ACAC", 84 | "~ c #47474747AEAE", 85 | "^ c #47474747AFAF", 86 | "/ c #47474747B4B4", 87 | "( c #47474747B9B9", 88 | ") c #47474747BABA", 89 | "_ c #00003737C5C5", 90 | "` c #00003737CCCC", 91 | "' c #00003737D2D2", 92 | "] c #00003737D8D8", 93 | "[ c #00003737DFDF", 94 | "{ c #00005A5AC3C3", 95 | "} c #00006C6CD6D6", 96 | "| c #00007F7FE9E9", 97 | " . c #47474747C0C0", 98 | ".. c #47474747C1C1", 99 | "X. c #44444444C4C4", 100 | "o. c #46464646C6C6", 101 | "O. c #47474747C6C6", 102 | "+. c #47474747C7C7", 103 | "@. c #00009191FCFC", 104 | "#. c #00009494FFFF", 105 | "$. c #909090909090", 106 | "%. c #80808080A2A2", 107 | "&. c #82828282A3A3", 108 | "*. c #8C8C8C8CA8A8", 109 | "=. c #8F8F8F8FA9A9", 110 | "-. c #98989898ADAD", 111 | ";. c #99999999AEAE", 112 | ":. c #A4A4A4A4A4A4", 113 | ">. c gray66", 114 | ",. c #ACACACACACAC", 115 | "<. c #A3A3A3A3B2B2", 116 | "1. c #A4A4A4A4B3B3", 117 | "2. c #A7A7A7A7B4B4", 118 | "3. c #B0B0B0B0B8B8", 119 | "4. c #B1B1B1B1B9B9", 120 | "5. c #BCBCBCBCBDBD", 121 | "6. c #BCBCBCBCBEBE", 122 | "7. c gray75", 123 | "8. c None", 124 | /* pixels */ 125 | ": * = g j b b : 7 >.8.8.8.8.8.8.", 126 | "k v z - O c f 4 , > 6 >.8.8.8.", 127 | "b #.#.@.q ] ` 8 D N n 2 o ; 3 ,.", 128 | "b #.#.| w [ [ e +.+. ./ W C % . ", 129 | "b #.#.} r [ [ e +.+.+.+.+.+.) G ", 130 | "b #.#.{ _ [ [ e +.+.+.+.+.+.~ I ", 131 | "b #.#.x ' [ [ e +.+.+.+.+.+.T *.", 132 | "& l h + e e e 0 X.+.+.+.+.+.Z 1.", 133 | "$.5 <.A +.+.+.d t o.+.+.+.O.m 6.", 134 | "8.< P R +.+.+.+.a u +.+.+.( H 8.", 135 | "8.:.# ^ +.+.+.+.+.i i +.+.! U 8.", 136 | "8.8.$ p +.+.+.+.+.+.u a +.Y =.8.", 137 | "8.5.J @ M S Q / ..+.o.y s V 2.8.", 138 | "8.8.8.8.4.;.&.L B N F E 9 1 7.8.", 139 | "8.8.8.8.8.8.8.8.8.3.-.%.K X 8.8." 140 | }; 141 | -------------------------------------------------------------------------------- /src/dlgctrl.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include "_common.hpp" 31 | #include 32 | #include 33 | 34 | 35 | class ASSDrawFrame; 36 | 37 | class ASSDrawSrcTxtCtrl : public wxTextCtrl 38 | { 39 | public: 40 | ASSDrawSrcTxtCtrl(wxWindow *parent, ASSDrawFrame *frame); 41 | virtual void CustomOnChar(wxKeyEvent &event); 42 | virtual void CustomOnText(wxCommandEvent &event); 43 | 44 | protected: 45 | ASSDrawFrame *m_frame; 46 | DECLARE_EVENT_TABLE() 47 | }; 48 | 49 | struct EightDouble 50 | { 51 | double f1, f2, f3, f4, f5, f6, f7, f8; 52 | }; 53 | 54 | class ASSDrawTransformDlg : public wxDialog 55 | { 56 | 57 | public: 58 | ASSDrawTransformDlg(ASSDrawFrame* parent); 59 | void OnTemplatesCombo(wxCommandEvent &event); 60 | void EndModal(int retCode); 61 | 62 | ASSDrawFrame* m_frame; 63 | wxComboBox* combo_templates; 64 | wxTextCtrl* txtctrl_m11; 65 | wxTextCtrl* txtctrl_m12; 66 | wxTextCtrl* txtctrl_m21; 67 | wxTextCtrl* txtctrl_m22; 68 | wxTextCtrl* txtctrl_mx; 69 | wxTextCtrl* txtctrl_my; 70 | wxTextCtrl* txtctrl_nx; 71 | wxTextCtrl* txtctrl_ny; 72 | EightDouble xformvals; 73 | 74 | static wxString combo_templatesStrings[]; 75 | static int combo_templatesCount; 76 | static EightDouble combo_templatesValues[]; 77 | 78 | DECLARE_EVENT_TABLE() 79 | 80 | }; 81 | 82 | class ASSDrawAboutDlg : public wxDialog 83 | { 84 | public: 85 | ASSDrawAboutDlg(ASSDrawFrame *parent, unsigned timeout = 0); 86 | virtual ~ASSDrawAboutDlg(); 87 | virtual void OnURL(wxHtmlLinkEvent &event); 88 | virtual int ShowModal(); 89 | virtual void OnTimeout(wxTimerEvent& event); 90 | virtual void OnMouseEnterWindow(wxMouseEvent& event); 91 | 92 | protected: 93 | wxTimer timer; 94 | wxHtmlWindow *htmlwin; 95 | const unsigned time_out; 96 | }; 97 | 98 | class BigStaticBitmapCtrl : public wxPanel 99 | { 100 | public: 101 | BigStaticBitmapCtrl(wxWindow *parent, wxBitmap bmap, wxColour bgcol, wxWindow *todrag = NULL); 102 | virtual ~BigStaticBitmapCtrl(); 103 | virtual void OnPaint(wxPaintEvent& event); 104 | virtual void OnMouseLeftDown(wxMouseEvent &event); 105 | virtual void OnMouseLeftUp(wxMouseEvent &event); 106 | virtual void OnMouseMove(wxMouseEvent &event); 107 | 108 | protected: 109 | wxBitmap bitmap; 110 | wxBrush bgbrush; 111 | wxWindow *window_to_drag; 112 | wxPoint dragpoint, wndpos; 113 | 114 | DECLARE_EVENT_TABLE() 115 | }; 116 | -------------------------------------------------------------------------------- /src/settings.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include "_common.hpp" 31 | #include 32 | #include 33 | 34 | class ASSDrawFrame; 35 | 36 | DECLARE_EVENT_TYPE(wxEVT_SETTINGS_CHANGED, -1) 37 | 38 | typedef wxPGProperty* wxPGId; 39 | 40 | class ASSDrawSettingsDialog : public wxPanel 41 | { 42 | public: 43 | 44 | ASSDrawFrame* m_frame; 45 | 46 | ASSDrawSettingsDialog( wxWindow *parent, ASSDrawFrame *frame, int id = wxID_ANY ); 47 | virtual ~ASSDrawSettingsDialog(); 48 | 49 | virtual void Init(); 50 | virtual void OnSettingsApplyButtonClicked(wxCommandEvent &event); 51 | virtual void OnSettingsRevertButtonClicked(wxCommandEvent &event); 52 | virtual void RefreshSettingsDisplay(); 53 | 54 | wxPGId colors_canvas_bg_pgid; 55 | wxPGId colors_canvas_shape_normal_pgid; 56 | wxPGId colors_canvas_shape_preview_pgid; 57 | wxPGId colors_canvas_shape_outline_pgid; 58 | wxPGId colors_canvas_shape_guideline_pgid; 59 | wxPGId colors_canvas_shape_mainpoint_pgid; 60 | wxPGId colors_canvas_shape_controlpoint_pgid; 61 | wxPGId colors_canvas_shape_selectpoint_pgid; 62 | wxPGId colors_library_shape_pgid; 63 | wxPGId colors_library_libarea_pgid; 64 | wxPGId colors_origin_pgid; 65 | wxPGId colors_ruler_h_pgid; 66 | wxPGId colors_ruler_v_pgid; 67 | wxPGId alphas_canvas_shape_normal_pgid; 68 | wxPGId alphas_canvas_shape_preview_pgid; 69 | wxPGId alphas_canvas_shape_outline_pgid; 70 | wxPGId alphas_canvas_shape_guideline_pgid; 71 | wxPGId alphas_canvas_shape_mainpoint_pgid; 72 | wxPGId alphas_canvas_shape_controlpoint_pgid; 73 | wxPGId alphas_canvas_shape_selectpoint_pgid; 74 | wxPGId sizes_origincross_pgid; 75 | wxPGId behaviors_capitalizecmds_pgid; 76 | wxPGId behaviors_autoaskimgopac_pgid; 77 | wxPGId behaviors_parse_spc_pgid; 78 | wxPGId behaviors_nosplashscreen_pgid; 79 | wxPGId behaviors_confirmquit_pgid; 80 | 81 | wxPropertyGrid *propgrid; 82 | //DECLARE_EVENT_TABLE() 83 | 84 | }; 85 | 86 | class wxLongPropertyValidator : public wxValidator 87 | { 88 | public: 89 | 90 | wxLongPropertyValidator( const int min, const int max ) 91 | : wxValidator() 92 | { 93 | m_min = min, m_max = max; 94 | } 95 | 96 | virtual wxObject* Clone() const 97 | { 98 | return new wxLongPropertyValidator( m_min, m_max ); 99 | } 100 | 101 | virtual bool Validate(wxWindow* WXUNUSED(parent)) 102 | { 103 | wxTextCtrl* tc = wxDynamicCast(GetWindow(), wxTextCtrl); 104 | wxCHECK_MSG(tc, true, wxT("validator window must be wxTextCtrl")); 105 | 106 | wxString val = tc->GetValue(); 107 | 108 | long valint = 0; 109 | val.ToLong(&valint); 110 | 111 | if (valint < m_min) valint = m_min; 112 | if (valint > m_max) valint = m_max; 113 | 114 | tc->SetValue(wxString::Format(_T("%d"), valint)); 115 | 116 | return true; 117 | } 118 | 119 | private: 120 | int m_min, m_max; 121 | }; 122 | -------------------------------------------------------------------------------- /src/wxAGG/AGGWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "AGGWindow.h" 2 | 3 | #include "agg_rendering_buffer.h" 4 | #include "agg_pixfmt_rgb.h" 5 | 6 | #include 7 | 8 | namespace GUI { 9 | 10 | BEGIN_EVENT_TABLE(AGGWindow, wxWindow) 11 | EVT_PAINT(AGGWindow::onPaint) 12 | EVT_SIZE(AGGWindow::onSize) 13 | EVT_ERASE_BACKGROUND(AGGWindow::onEraseBackground) 14 | END_EVENT_TABLE() 15 | 16 | AGGWindow::AGGWindow(wxWindow* parent, wxWindowID id, 17 | const wxPoint& pos, const wxSize& size, long style): 18 | wxWindow(parent, id, pos, size, style, wxT("AGGWindow")), 19 | bitmap(NULL) { 20 | } 21 | 22 | void AGGWindow::init(const int width, const int height) { 23 | memDC.SelectObject(wxNullBitmap); 24 | delete bitmap; 25 | 26 | int ncheight = height, ncwidth = width; 27 | if (ncwidth < 1) ncwidth = 1; 28 | if (ncheight < 1) ncheight = 1; 29 | 30 | bitmap = new wxBitmap(ncwidth, ncheight, PixelFormat::wxWidgetsType::BitsPerPixel); 31 | 32 | // Draw the bitmap 33 | attachAndDraw(); 34 | 35 | memDC.SelectObject(*bitmap); 36 | 37 | // Request a full redraw of the window 38 | Refresh(false); 39 | } 40 | 41 | AGGWindow::~AGGWindow() { 42 | memDC.SelectObject(wxNullBitmap); 43 | delete bitmap; 44 | } 45 | 46 | void AGGWindow::attachAndDraw() { 47 | // Get raw access to the wxWidgets bitmap -- this locks the pixels and 48 | // unlocks on destruction. 49 | PixelData data(*bitmap); 50 | assert(data); 51 | 52 | #if 1 53 | // This cast looks like it is ignoring byte-ordering, but the 54 | // pixel format already explicitly handles that. 55 | assert(data.GetPixels().IsOk()); 56 | wxAlphaPixelFormat::ChannelType* pd = (wxAlphaPixelFormat::ChannelType*) &data.GetPixels().Data(); 57 | 58 | // wxWidgets always returns a pointer to the first row of pixels, whether 59 | // that is stored at the beginning of the buffer (stride > 0) or at the 60 | // end of the buffer (stride < 0). AGG always wants a pointer to the 61 | // beginning of the buffer, no matter what the stride. (AGG does handle 62 | // negative strides correctly.) 63 | // Upshot: if the stride is negative, rewind the pointer from the end of 64 | // the buffer to the beginning. 65 | const int stride = data.GetRowStride(); 66 | if (stride < 0) 67 | pd += (data.GetHeight() - 1) * stride; 68 | 69 | rBuf.attach(pd, data.GetWidth(), data.GetHeight(), stride); 70 | 71 | // Call the user code to actually draw. 72 | draw(); 73 | #else 74 | PixelData::Iterator p(data); 75 | 76 | // we draw a (10, 10)-(20, 20) rect manually using the given r, g, b 77 | p.Offset(data, 10, 10); 78 | 79 | for ( int y = 0; y < 10; ++y ) 80 | { 81 | PixelData::Iterator rowStart = p; 82 | 83 | for ( int x = 0; x < 10; ++x, ++p ) 84 | { 85 | p.Red() = 255; 86 | p.Green() = 0; 87 | p.Blue() = 255; 88 | } 89 | 90 | p = rowStart; 91 | p.OffsetY(data, 1); 92 | } 93 | #endif 94 | } 95 | 96 | void AGGWindow::onSize(wxSizeEvent& event) { 97 | const wxSize size = GetClientSize(); 98 | if (bitmap && size.GetWidth() == bitmap->GetWidth() && size.GetHeight() == bitmap->GetHeight()) 99 | return; 100 | 101 | init(size.GetWidth(), size.GetHeight()); 102 | } 103 | 104 | void AGGWindow::onPaint(wxPaintEvent& event) { 105 | wxPaintDC dc(this); 106 | 107 | wxCoord width, height; 108 | dc.GetSize(&width, &height); 109 | if (!bitmap || bitmap->GetWidth() != width || bitmap->GetHeight() != height) 110 | init(width, height); 111 | 112 | // Iterate over regions needing repainting 113 | wxRegionIterator regions(GetUpdateRegion()); 114 | wxRect rect; 115 | while (regions) { 116 | rect = regions.GetRect(); 117 | dc.Blit(rect.x, rect.y, rect.width, rect.height, &memDC, rect.x, rect.y); 118 | ++regions; 119 | } 120 | } 121 | 122 | void AGGWindow::onEraseBackground(wxEraseEvent& WXUNUSED(event)) { 123 | // Do nothing to "avoid flashing in MSW" Grr. 124 | } 125 | 126 | } 127 | 128 | -------------------------------------------------------------------------------- /src/wxAGG/PixelFormatConvertor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef WX_AGG_PIXEL_FORMAT_CONVERTOR_H 29 | #define WX_AGG_PIXEL_FORMAT_CONVERTOR_H 30 | 31 | #include "agg_pixfmt_rgb.h" 32 | #include "agg_pixfmt_rgba.h" 33 | 34 | namespace { 35 | 36 | /// Given a particular combination of channel type, bits per pixel and 37 | /// channel indices, return the AGG format that matches. 38 | /// The actual template specializations that follow give the actual types, 39 | /// and using a combination of parameters that are not listed will give 40 | /// a compile-time error. 41 | template 42 | struct wxWidgetsToAGGHelper { 43 | //empty 44 | }; 45 | 46 | /// 24-bit RGB 47 | template <> struct wxWidgetsToAGGHelper { 48 | typedef agg::pixfmt_rgb24 format; 49 | }; 50 | 51 | /// 24-bit BGR 52 | template <> struct wxWidgetsToAGGHelper { 53 | typedef agg::pixfmt_bgr24 format; 54 | }; 55 | 56 | /// 32-bit RGB, alpha unused but stored as ARGB. 57 | template <> struct wxWidgetsToAGGHelper { 58 | typedef agg::pixfmt_argb32 format; 59 | }; 60 | 61 | /// 32-bit RGB, alpha unused but stored as RGBA. 62 | template <> struct wxWidgetsToAGGHelper { 63 | typedef agg::pixfmt_rgba32 format; 64 | }; 65 | 66 | /// 32-bit BGR, alpha unused but stored as ABGR. 67 | template <> struct wxWidgetsToAGGHelper { 68 | typedef agg::pixfmt_abgr32 format; 69 | }; 70 | 71 | /// 32-bit BGR, alpha unused but stored as BGRA. 72 | template <> struct wxWidgetsToAGGHelper { 73 | typedef agg::pixfmt_bgra32 format; 74 | }; 75 | 76 | /// 32-bit RGBA 77 | template <> struct wxWidgetsToAGGHelper { 78 | typedef agg::pixfmt_rgba32 format; 79 | }; 80 | 81 | /// 32-bit BGRA 82 | template <> struct wxWidgetsToAGGHelper { 83 | typedef agg::pixfmt_bgra32 format; 84 | }; 85 | 86 | /// 32-bit ARGB 87 | template <> struct wxWidgetsToAGGHelper { 88 | typedef agg::pixfmt_argb32 format; 89 | }; 90 | 91 | /// 32-bit ABGR 92 | template <> struct wxWidgetsToAGGHelper { 93 | typedef agg::pixfmt_abgr32 format; 94 | }; 95 | } 96 | 97 | namespace GUI { 98 | /// Convert between a wxWidgets pixel format class and an AGG pixel format class. 99 | /// Usage examples: 100 | /// PixelFormatConvertor::AGGType or 101 | /// PixelFormatConvertor::AGGType. 102 | template 103 | class PixelFormatConvertor { 104 | public: 105 | typedef wxWidgetsPixelFormat wxWidgetsType; 106 | 107 | // Break out the wxWidgets parameters and feed to the helper class. 108 | typedef typename wxWidgetsToAGGHelper::format AGGType; 114 | }; 115 | } 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /src/include_once.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Name: include_once.hpp 29 | // Purpose: A header file that is included exactly once for the whole code 30 | // (supposed to be included by assdraw.cpp only) 31 | // Put must-define-exactly-once codes here 32 | // Author: ai-chan 33 | // Created: 08/26/06 34 | // Copyright: (c) ai-chan 35 | // Licence: 3-clause BSD 36 | /////////////////////////////////////////////////////////////////////////////// 37 | 38 | // tooltips 39 | const wxString TIPS_CLEAR = wxT("Clear the canvas and create a new drawing"); 40 | const wxString TIPS_EDITSRC = wxT("Edit the source"); 41 | const wxString TIPS_PREVIEW = wxT("Draw the shapes without enlarged points and control points"); 42 | const wxString TIPS_TRANSFORM = wxT("Transform the drawing using matrix transformation"); 43 | const wxString TIPS_LIBRARY = wxT("Shapes library"); 44 | const wxString TIPS_HELP = wxT("Help! Help!"); 45 | const wxString TIPS_PASTE = wxT("Depending on what's in the clipboard, import as drawing commands or background"); 46 | const wxString TIPS_UNDO = wxT("Undo last action"); 47 | const wxString TIPS_REDO = wxT("Redo last undo"); 48 | const wxString TIPS_ARR = wxT("Drag mode"); 49 | const wxString TIPS_M = wxT("Draw M mode (Close current shape and move the virtual pen to a new point)"); 50 | const wxString TIPS_N = wxT("Draw N mode (Same as M but doesn't close the shape)"); 51 | const wxString TIPS_L = wxT("Draw L mode (Straight line)"); 52 | const wxString TIPS_B = wxT("Draw B mode (Cubic Bezier curve)"); 53 | const wxString TIPS_S = wxT("Draw S mode (Spline)"); 54 | const wxString TIPS_P = wxT("Draw P mode (Extends a spline with another point)"); 55 | const wxString TIPS_C = wxT("Draw C mode (Close the last spline)"); 56 | const wxString TIPS_DEL = wxT("Delete mode"); 57 | const wxString TIPS_NUTB = wxT("Bilinear transformation mode: Drag the vertices to distort the shape; Dragging an edge moves two adjacent vertices together"); 58 | const wxString TIPS_SCALEROTATE = wxT("Scale/Rotate mode: Drag a vertex or an edge to rescale the shape; Right-drag to rotate"); 59 | const wxString TIPS_DWG = wxT("Right-dragging pans drawing, mousewheel zooms in/out drawing"); 60 | const wxString TIPS_BGIMG = wxT("Right-dragging pans background, mousewheel zooms in/out background"); 61 | const wxString TIPS_BOTH = wxT("Right-dragging pans drawing & background, mousewheel zooms in/out drawing & background"); 62 | 63 | const wxString TBNAME_DRAW = wxT("Canvas"); 64 | const wxString TBNAME_MODE = wxT("Drawing mode"); 65 | const wxString TBNAME_BGIMG = wxT("Background"); 66 | const wxString TBNAME_ZOOM = wxT("Zoom"); 67 | 68 | wxString ASSDrawTransformDlg::combo_templatesStrings[] = { 69 | _(" 85 | { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 5.0f }, //5 units down 86 | { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 5.0f, 0.0f }, //5 units left 87 | { 0.0f, -1.0f, 1.0f, 0.0f, 1.0f, 2.0f, 1.0f, 2.0f }, //90 CW (1,2) 88 | { 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 2.0f, -1.0f, 2.0f }, //90 CCW, (-1,2) 89 | { -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f }, //180 (0,0) 90 | { -1.0f, 0.0f, 0.0f, 1.0f, 4.0f, 0.0f, 4.0f, 0.0f }, //Flip X = 4 91 | { 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 3.0f, 0.0f, 3.0f }, //Flip Y = 3 92 | { 2.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }, //Scale X * 2 93 | { 1.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f } //Scale Y * 3 94 | }; 95 | -------------------------------------------------------------------------------- /src/Makefile.win: -------------------------------------------------------------------------------- 1 | # Project: ASSDraw 2 | # Compiler: Default GCC compiler 3 | # Compiler Type: MingW 3 4 | # Makefile created by wxDev-C++ 6.10.2 on 20/01/08 23:46 5 | 6 | CPP = g++.exe 7 | CC = gcc.exe 8 | WINDRES = windres.exe 9 | OBJ = ../Default\ Profile/assdraw.o ../Default\ Profile/cmd.o ../Default\ Profile/engine.o ../Default\ Profile/dlgctrl.o ../Default\ Profile/canvas.o ../Default\ Profile/AGGWindow.o ../Default\ Profile/agg_vcgen_bcspline.o ../Default\ Profile/agg_bcspline.o ../Default\ Profile/library.o ../Default\ Profile/settings.o ../Default\ Profile/assdraw_settings.o ../Default\ Profile/canvas_mouse.o ../Default\ Profile/ASSDraw3_private.res 10 | LINKOBJ = "../Default Profile/assdraw.o" "../Default Profile/cmd.o" "../Default Profile/engine.o" "../Default Profile/dlgctrl.o" "../Default Profile/canvas.o" "../Default Profile/AGGWindow.o" "../Default Profile/agg_vcgen_bcspline.o" "../Default Profile/agg_bcspline.o" "../Default Profile/library.o" "../Default Profile/settings.o" "../Default Profile/assdraw_settings.o" "../Default Profile/canvas_mouse.o" "../Default Profile/ASSDraw3_private.res" 11 | LIBS = -L"D:/Program Files/Dev-Cpp/Lib" -L"E:/DEV/agg-2.5" -L"E:/DEV/wxTreeMultiCtrl" -lwxmsw28_propgrid -mwindows -lwxmsw28 -lwxmsw28_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32 -lagg -s 12 | INCS = -I"include" -I"E:/DEV" -I"E:/DEV/agg-2.5/include" -I"E:/DEV/wxTreeMultiCtrl/include" 13 | CXXINCS = -I"D:/Program Files/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/backward" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2" -I"D:/Program Files/Dev-Cpp/include" -I"D:/Program Files/Dev-Cpp/" -I"D:/Program Files/Dev-Cpp/include/common/wx/msw" -I"D:/Program Files/Dev-Cpp/include/common/wx/generic" -I"D:/Program Files/Dev-Cpp/include/common/wx/fl" -I"D:/Program Files/Dev-Cpp/include/common/wx/gizmos" -I"D:/Program Files/Dev-Cpp/include/common/wx/html" -I"D:/Program Files/Dev-Cpp/include/common/wx/mmedia" -I"D:/Program Files/Dev-Cpp/include/common/wx/net" -I"D:/Program Files/Dev-Cpp/include/common/wx/ogl" -I"D:/Program Files/Dev-Cpp/include/common/wx/plot" -I"D:/Program Files/Dev-Cpp/include/common/wx/protocol" -I"D:/Program Files/Dev-Cpp/include/common/wx/stc" -I"D:/Program Files/Dev-Cpp/include/common/wx/svg" -I"D:/Program Files/Dev-Cpp/include/common/wx/xml" -I"D:/Program Files/Dev-Cpp/include/common/wx/xrc" -I"D:/Program Files/Dev-Cpp/include/common/wx" -I"D:/Program Files/Dev-Cpp/include/common" -I"E:/dev/ACE-5.5" -I"E:/DEV" -I"E:/DEV/agg-2.5/include" -I"E:/DEV/wxTreeMultiCtrl/include" 14 | RCINCS = --include-dir "D:/PROGRA~1/Dev-Cpp/include/common" 15 | BIN = ../Default\ Profile/ASSDraw3.exe 16 | DEFINES = 17 | CXXFLAGS = $(CXXINCS) $(DEFINES) -D__WXMSW__ -DNO_GCC_PRAGMA -fno-rtti -fno-exceptions -Wno-deprecated -fexpensive-optimizations -O3 18 | CFLAGS = $(INCS) $(DEFINES) -fexpensive-optimizations -O3 19 | GPROF = gprof.exe 20 | RM = rm -f 21 | LINK = g++.exe 22 | 23 | .PHONY: all all-before all-after clean clean-custom 24 | all: all-before $(BIN) all-after 25 | 26 | clean: clean-custom 27 | $(RM) $(OBJ) $(BIN) 28 | 29 | $(BIN): $(OBJ) 30 | $(LINK) $(LINKOBJ) -o "..\Default Profile\ASSDraw3.exe" $(LIBS) 31 | 32 | ../Default\ Profile/assdraw.o: $(GLOBALDEPS) assdraw.cpp assdraw.hpp _common.hpp enums.hpp include_once.hpp 33 | $(CPP) -c assdraw.cpp -o "../Default Profile/assdraw.o" $(CXXFLAGS) 34 | 35 | ../Default\ Profile/cmd.o: $(GLOBALDEPS) cmd.cpp 36 | $(CPP) -c cmd.cpp -o "../Default Profile/cmd.o" $(CXXFLAGS) 37 | 38 | ../Default\ Profile/engine.o: $(GLOBALDEPS) engine.cpp 39 | $(CPP) -c engine.cpp -o "../Default Profile/engine.o" $(CXXFLAGS) 40 | 41 | ../Default\ Profile/dlgctrl.o: $(GLOBALDEPS) dlgctrl.cpp assdraw.hpp _common.hpp 42 | $(CPP) -c dlgctrl.cpp -o "../Default Profile/dlgctrl.o" $(CXXFLAGS) 43 | 44 | ../Default\ Profile/canvas.o: $(GLOBALDEPS) canvas.cpp assdraw.hpp _common.hpp cmd.hpp agghelper.hpp 45 | $(CPP) -c canvas.cpp -o "../Default Profile/canvas.o" $(CXXFLAGS) 46 | 47 | ../Default\ Profile/AGGWindow.o: $(GLOBALDEPS) wxAGG/AGGWindow.cpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h 48 | $(CPP) -c wxAGG/AGGWindow.cpp -o "../Default Profile/AGGWindow.o" $(CXXFLAGS) 49 | 50 | ../Default\ Profile/agg_vcgen_bcspline.o: $(GLOBALDEPS) agg_vcgen_bcspline.cpp agg_vcgen_bcspline.h agg_bcspline.h 51 | $(CPP) -c agg_vcgen_bcspline.cpp -o "../Default Profile/agg_vcgen_bcspline.o" $(CXXFLAGS) 52 | 53 | ../Default\ Profile/agg_bcspline.o: $(GLOBALDEPS) agg_bcspline.cpp agg_bcspline.h 54 | $(CPP) -c agg_bcspline.cpp -o "../Default Profile/agg_bcspline.o" $(CXXFLAGS) 55 | 56 | ../Default\ Profile/library.o: $(GLOBALDEPS) library.cpp assdraw.hpp _common.hpp library.hpp engine.hpp _common.hpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h agg_conv_bcspline.h agg_vcgen_bcspline.h agg_bcspline.h 57 | $(CPP) -c library.cpp -o "../Default Profile/library.o" $(CXXFLAGS) 58 | 59 | ../Default\ Profile/settings.o: $(GLOBALDEPS) settings.cpp assdraw.hpp _common.hpp settings.hpp _common.hpp 60 | $(CPP) -c settings.cpp -o "../Default Profile/settings.o" $(CXXFLAGS) 61 | 62 | ../Default\ Profile/assdraw_settings.o: $(GLOBALDEPS) assdraw_settings.cpp assdraw.hpp _common.hpp 63 | $(CPP) -c assdraw_settings.cpp -o "../Default Profile/assdraw_settings.o" $(CXXFLAGS) 64 | 65 | ../Default\ Profile/canvas_mouse.o: $(GLOBALDEPS) canvas_mouse.cpp canvas_mouse.hpp _common.hpp enums.hpp engine.hpp _common.hpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h agg_conv_bcspline.h agg_vcgen_bcspline.h agg_bcspline.h canvas.hpp engine.hpp enums.hpp 66 | $(CPP) -c canvas_mouse.cpp -o "../Default Profile/canvas_mouse.o" $(CXXFLAGS) 67 | 68 | ../Default\ Profile/ASSDraw3_private.res: ../Default\ Profile/ASSDraw3_private.rc assdraw.rc 69 | $(WINDRES) --input-format=rc -o "../Default Profile/ASSDraw3_private.res" $(RCINCS) ../DEFAUL~1/ASSDRA~1.RC -O coff 70 | -------------------------------------------------------------------------------- /src/ASSDraw3.dev: -------------------------------------------------------------------------------- 1 | [Project] 2 | FileName=ASSDraw3.dev 3 | Name=ASSDraw 4 | UnitCount=26 5 | Type=0 6 | Ver=3 7 | IsCpp=1 8 | Folders=AGG 9 | CommandLine= 10 | CompilerSettings=0000000001001000000100 11 | PchHead=-1 12 | PchSource=-1 13 | ProfilesCount=1 14 | ProfileIndex=0 15 | 16 | [Unit1] 17 | FileName=assdraw.cpp 18 | CompileCpp=1 19 | Folder= 20 | Compile=1 21 | Link=1 22 | Priority=1000 23 | OverrideBuildCmd=0 24 | BuildCmd= 25 | 26 | [VersionInfo] 27 | Major=3 28 | Minor=0 29 | Release=0 30 | Build=0 31 | LanguageID=1033 32 | CharsetID=1252 33 | CompanyName=ai-chan 34 | FileVersion=3.0.0.0 35 | FileDescription=A tool for designing shapes to be used in ASS subtitle 36 | InternalName=ASSDraw3 37 | LegalCopyright= 38 | LegalTrademarks= 39 | OriginalFilename=ASSDraw3.exe 40 | ProductName=ASSDraw 41 | ProductVersion=3 42 | AutoIncBuildNrOnRebuild=0 43 | AutoIncBuildNrOnCompile=0 44 | UnitCount=20 45 | 46 | [Unit3] 47 | FileName=cmd.hpp 48 | CompileCpp=1 49 | Folder= 50 | Compile=1 51 | Link=1 52 | Priority=1000 53 | OverrideBuildCmd=0 54 | BuildCmd= 55 | 56 | [Unit4] 57 | FileName=engine.hpp 58 | CompileCpp=1 59 | Folder= 60 | Compile=1 61 | Link=1 62 | Priority=1000 63 | OverrideBuildCmd=0 64 | BuildCmd= 65 | 66 | [Unit5] 67 | FileName=assdraw.rc 68 | CompileCpp=1 69 | Folder=Resources 70 | Compile=1 71 | Link=0 72 | Priority=1000 73 | OverrideBuildCmd=0 74 | BuildCmd= 75 | 76 | [Unit7] 77 | FileName=engine.cpp 78 | Folder= 79 | Compile=1 80 | Link=1 81 | Priority=1000 82 | OverrideBuildCmd=0 83 | BuildCmd= 84 | CompileCpp=1 85 | 86 | [Unit9] 87 | FileName=include_once.hpp 88 | CompileCpp=1 89 | Folder= 90 | Compile=1 91 | Link=1 92 | Priority=1000 93 | OverrideBuildCmd=0 94 | BuildCmd= 95 | 96 | [Unit6] 97 | FileName=assdraw.hpp 98 | Folder= 99 | Compile=1 100 | Link=1 101 | Priority=1000 102 | OverrideBuildCmd=0 103 | BuildCmd= 104 | CompileCpp=1 105 | 106 | [Unit2] 107 | FileName=cmd.cpp 108 | CompileCpp=1 109 | Folder= 110 | Compile=1 111 | Link=1 112 | Priority=1000 113 | OverrideBuildCmd=0 114 | BuildCmd= 115 | 116 | [Profile1] 117 | ProfileName=Default Profile 118 | Type=0 119 | ObjFiles= 120 | Includes=E:\DEV;E:\DEV\agg-2.5\include;E:\DEV\wxTreeMultiCtrl\include 121 | Libs=E:\DEV\agg-2.5;E:\DEV\wxTreeMultiCtrl 122 | PrivateResource=E:\DEV\_projects\ASSDraw 3\Default Profile\ASSDraw_private.rc 123 | ResourceIncludes= 124 | MakeIncludes= 125 | Compiler= 126 | CppCompiler=-D__WXMSW__ -DNO_GCC_PRAGMA -fno-rtti -fno-exceptions_@@_ -Wno-deprecated_@@_ 127 | Linker=-lwxmsw28_propgrid_@@_-mwindows_@@_-lwxmsw28_@@_-lwxmsw28_gl_@@_-lwxtiff_@@_-lwxjpeg_@@_-lwxpng_@@_-lwxzlib_@@_-lwxregex_@@_-lwxexpat_@@_-lkernel32_@@_-luser32_@@_-lgdi32_@@_-lcomdlg32_@@_-lwinspool_@@_-lwinmm_@@_-lshell32_@@_-lcomctl32_@@_-lole32_@@_-loleaut32_@@_-luuid_@@_-lrpcrt4_@@_-ladvapi32_@@_-lwsock32_@@_-lodbc32_@@_-lopengl32_@@_-lagg_@@_ 128 | PreprocDefines= 129 | CompilerSettings=0000000001001000000100 130 | Icon= 131 | ExeOutput=E:\DEV\_projects\ASSDraw 3\Default Profile\ 132 | ObjectOutput=E:\DEV\_projects\ASSDraw 3\Default Profile\ 133 | OverrideOutput=1 134 | OverrideOutputName=ASSDraw3.exe 135 | HostApplication= 136 | CommandLine= 137 | UseCustomMakefile=0 138 | CustomMakefile= 139 | IncludeVersionInfo=1 140 | SupportXPThemes=1 141 | CompilerSet=0 142 | compilerType=0 143 | 144 | [Unit8] 145 | FileName=dlgctrl.cpp 146 | CompileCpp=1 147 | Folder= 148 | Compile=1 149 | Link=1 150 | Priority=1000 151 | OverrideBuildCmd=0 152 | BuildCmd= 153 | 154 | [Unit10] 155 | FileName=resource.h 156 | CompileCpp=1 157 | Folder= 158 | Compile=1 159 | Link=1 160 | Priority=1000 161 | OverrideBuildCmd=0 162 | BuildCmd= 163 | 164 | [Unit15] 165 | FileName=agg_bcspline.cpp 166 | CompileCpp=1 167 | Folder=AGG 168 | Compile=1 169 | Link=1 170 | Priority=1000 171 | OverrideBuildCmd=0 172 | BuildCmd= 173 | 174 | [Unit16] 175 | FileName=enums.hpp 176 | CompileCpp=1 177 | Folder= 178 | Compile=1 179 | Link=1 180 | Priority=1000 181 | OverrideBuildCmd=0 182 | BuildCmd= 183 | 184 | [Unit18] 185 | FileName=library.cpp 186 | CompileCpp=1 187 | Folder= 188 | Compile=1 189 | Link=1 190 | Priority=1000 191 | OverrideBuildCmd=0 192 | BuildCmd= 193 | 194 | [Unit17] 195 | FileName=library.hpp 196 | CompileCpp=1 197 | Folder= 198 | Compile=1 199 | Link=1 200 | Priority=1000 201 | OverrideBuildCmd=0 202 | BuildCmd= 203 | 204 | [Unit13] 205 | FileName=wxAGG\AGGWindow.cpp 206 | CompileCpp=1 207 | Folder=AGG 208 | Compile=1 209 | Link=1 210 | Priority=1000 211 | OverrideBuildCmd=0 212 | BuildCmd= 213 | 214 | [Unit14] 215 | FileName=agg_vcgen_bcspline.cpp 216 | CompileCpp=1 217 | Folder=AGG 218 | Compile=1 219 | Link=1 220 | Priority=1000 221 | OverrideBuildCmd=0 222 | BuildCmd= 223 | 224 | [Unit11] 225 | FileName=canvas.cpp 226 | CompileCpp=1 227 | Folder= 228 | Compile=1 229 | Link=1 230 | Priority=1000 231 | OverrideBuildCmd=0 232 | BuildCmd= 233 | 234 | [Unit12] 235 | FileName=canvas.hpp 236 | CompileCpp=1 237 | Folder= 238 | Compile=1 239 | Link=1 240 | Priority=1000 241 | OverrideBuildCmd=0 242 | BuildCmd= 243 | 244 | [Unit20] 245 | FileName=dlgctrl.hpp 246 | CompileCpp=1 247 | Folder= 248 | Compile=1 249 | Link=1 250 | Priority=1000 251 | OverrideBuildCmd=0 252 | BuildCmd= 253 | 254 | [Unit19] 255 | FileName=_common.hpp 256 | CompileCpp=1 257 | Folder= 258 | Compile=1 259 | Link=1 260 | Priority=1000 261 | OverrideBuildCmd=0 262 | BuildCmd= 263 | 264 | [Unit21] 265 | FileName=settings.cpp 266 | CompileCpp=1 267 | Folder=ASSDraw 268 | Compile=1 269 | Link=1 270 | Priority=1000 271 | OverrideBuildCmd=0 272 | BuildCmd= 273 | 274 | [Unit22] 275 | FileName=settings.hpp 276 | CompileCpp=1 277 | Folder=ASSDraw 278 | Compile=1 279 | Link=1 280 | Priority=1000 281 | OverrideBuildCmd=0 282 | BuildCmd= 283 | 284 | [Unit23] 285 | FileName=assdraw_settings.cpp 286 | CompileCpp=1 287 | Folder= 288 | Compile=1 289 | Link=1 290 | Priority=1000 291 | OverrideBuildCmd=0 292 | BuildCmd= 293 | 294 | [Unit24] 295 | FileName=agghelper.hpp 296 | CompileCpp=1 297 | Folder= 298 | Compile=1 299 | Link=1 300 | Priority=1000 301 | OverrideBuildCmd=0 302 | BuildCmd= 303 | 304 | [Unit25] 305 | FileName=canvas_mouse.hpp 306 | CompileCpp=1 307 | Folder= 308 | Compile=1 309 | Link=1 310 | Priority=1000 311 | OverrideBuildCmd=0 312 | BuildCmd= 313 | 314 | [Unit26] 315 | FileName=canvas_mouse.cpp 316 | CompileCpp=1 317 | Folder= 318 | Compile=1 319 | Link=1 320 | Priority=1000 321 | OverrideBuildCmd=0 322 | BuildCmd= 323 | 324 | -------------------------------------------------------------------------------- /src/assdraw.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Name: assdraw.hpp 29 | // Purpose: header file for ASSDraw main source file; also includes 30 | // declarations for all GUI elements (except wxRuler, which has 31 | // its own header file) 32 | // Author: ai-chan 33 | // Created: 08/26/06 34 | // Copyright: (c) ai-chan 35 | // Licence: 3-clause BSD 36 | /////////////////////////////////////////////////////////////////////////////// 37 | 38 | #pragma once 39 | 40 | #include "_common.hpp" 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "canvas.hpp" // the canvas 49 | #include "dlgctrl.hpp" // custom dialogs & controls 50 | #include "settings.hpp" // settings property grid 51 | #include "library.hpp" // shape library 52 | 53 | //#define BETAVERSION 2 54 | #define VERSION _T("3.0 final") 55 | 56 | // this header file declares the following classes 57 | class ASSDrawApp; 58 | class ASSDrawFrame; 59 | class ASSDrawCanvas; 60 | 61 | class ASSDrawApp : public wxApp 62 | { 63 | public: 64 | bool OnInit(); 65 | }; 66 | 67 | class ASSDrawFrame : public wxFrame 68 | { 69 | public: 70 | // constructor 71 | ASSDrawFrame(wxApp *app, const wxString& title, const wxPoint& pos, const wxSize& size = wxDefaultSize, 72 | long style = wxDEFAULT_FRAME_STYLE); 73 | virtual ~ASSDrawFrame(); 74 | 75 | // event handlers (these functions should _not_ be virtual) 76 | // OnSelect_* for single items, OnChoose_* for many-choose-one items 77 | void OnSelect_Clear(wxCommandEvent& WXUNUSED(event)) { _Clear(); } 78 | void OnSelect_Preview(wxCommandEvent& WXUNUSED(event)) { _Preview(); } 79 | void OnSelect_Transform(wxCommandEvent& WXUNUSED(event)) { _Transform(); } 80 | void OnSelect_Library(wxCommandEvent& WXUNUSED(event)) { _ToggleLibrary(); } 81 | void OnSelect_Settings(wxCommandEvent& WXUNUSED(event)) { _ToggleSettings(); } 82 | void OnSelect_ResetPerspective(wxCommandEvent& WXUNUSED(event)) { _ResetPerspective(); } 83 | void OnSelect_Help(wxCommandEvent& WXUNUSED(event)) { _Help(); } 84 | void OnSelect_About(wxCommandEvent& WXUNUSED(event)) { _About(); } 85 | void OnSelect_Undo(wxCommandEvent& WXUNUSED(event)) { UndoOrRedo( true ); } 86 | void OnSelect_Redo(wxCommandEvent& WXUNUSED(event)) { UndoOrRedo( false ); } 87 | void OnSelect_Paste(wxCommandEvent& WXUNUSED(event)) { _Paste(); } 88 | void OnSelect_RemoveBG(wxCommandEvent& WXUNUSED(event)) { m_canvas->RemoveBackgroundImage(); } 89 | void OnSelect_AlphaBG(wxCommandEvent& WXUNUSED(event)) { m_canvas->AskUserForBackgroundAlpha(); } 90 | void OnChoose_Recenter(wxCommandEvent& event); 91 | void OnChoose_RecenterToBG(wxCommandEvent& event); 92 | void OnChoose_Mode(wxCommandEvent& event); 93 | void OnChoose_DragMode(wxCommandEvent& event); 94 | void OnZoomSliderChanged(wxScrollEvent &event); 95 | void OnToolRClick(wxCommandEvent& event); 96 | void OnChoose_TBarRClickMenu(wxCommandEvent& event); 97 | void OnSettingsChanged(wxCommandEvent& event); 98 | void OnClose(wxCloseEvent &event); 99 | 100 | void UpdateASSCommandStringToSrcTxtCtrl(wxString cmds); 101 | void UpdateASSCommandStringFromSrcTxtCtrl(wxString cmds); 102 | 103 | void UndoOrRedo(bool isundo); 104 | void UpdateUndoRedoMenu(); 105 | 106 | void _Clear(); 107 | void _Preview(); 108 | void _Transform(); 109 | void _ToggleLibrary(); 110 | void _ToggleSettings(); 111 | void _Help(); 112 | void _About(unsigned timeout = 0); 113 | void _Paste(); 114 | void _ResetPerspective(); 115 | 116 | void UpdateFrameUI(unsigned level = 0); 117 | 118 | // the canvas 119 | wxApp *m_app; 120 | ASSDrawCanvas* m_canvas; 121 | wxAuiManager m_mgr; 122 | wxString default_perspective; 123 | ASSDrawSrcTxtCtrl* srctxtctrl; 124 | 125 | // config 126 | wxString configfile; 127 | wxFileConfig *config; 128 | 129 | // toolbars 130 | wxToolBar *drawtbar, *modetbar, *bgimgtbar; 131 | 132 | // zoom slider 133 | wxSlider* zoomslider; 134 | 135 | //library 136 | ASSDrawShapeLibrary *shapelib; 137 | typedef std::vector< ASSDrawEngine* > DrawEngineVec; 138 | DrawEngineVec libshapes; 139 | 140 | // menus 141 | #if wxUSE_MENUS 142 | wxMenu *drawMenu; 143 | wxMenu *modeMenu; 144 | wxMenu *bgimgMenu; 145 | wxMenu *viewMenu; 146 | wxMenu *tbarMenu; 147 | #endif 148 | 149 | // dialogs 150 | ASSDrawTransformDlg* transformdlg; 151 | ASSDrawSettingsDialog* settingsdlg; 152 | 153 | // colors 154 | struct 155 | { 156 | wxColour canvas_bg; 157 | wxColour canvas_shape_normal; 158 | wxColour canvas_shape_preview; 159 | wxColour canvas_shape_outline; 160 | wxColour canvas_shape_guideline; 161 | wxColour canvas_shape_mainpoint; 162 | wxColour canvas_shape_controlpoint; 163 | wxColour canvas_shape_selectpoint; 164 | wxColour library_shape; 165 | wxColour library_libarea; 166 | wxColour origin, ruler_h, ruler_v; 167 | } colors; 168 | 169 | struct 170 | { 171 | long canvas_shape_normal; 172 | long canvas_shape_preview; 173 | long canvas_shape_outline; 174 | long canvas_shape_guideline; 175 | long canvas_shape_mainpoint; 176 | long canvas_shape_controlpoint; 177 | long canvas_shape_selectpoint; 178 | } alphas; 179 | 180 | struct 181 | { 182 | long origincross; 183 | } sizes; 184 | 185 | struct 186 | { 187 | bool capitalizecmds; 188 | bool autoaskimgopac; 189 | bool parse_spc; 190 | bool nosplashscreen; 191 | bool confirmquit; 192 | } behaviors; 193 | 194 | void LoadSettings(); 195 | void SaveSettings(); 196 | void InitializeDefaultSettings(); 197 | void ApplySettings(); 198 | static void wxColourToAggRGBA(wxColour &colour, agg::rgba &rgba); 199 | static void wxColourSetAlpha(wxColour &colour, long alpha); 200 | 201 | protected: 202 | virtual void SetToolBars(); 203 | virtual void SetMenus(); 204 | virtual void SetPanes(); 205 | DECLARE_EVENT_TABLE() 206 | 207 | wxHelpController helpcontroller; 208 | 209 | }; 210 | -------------------------------------------------------------------------------- /src/cmd.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Name: cmd.cpp 29 | // Purpose: ASSDraw drawing command classes 30 | // Author: ai-chan 31 | // Created: 08/26/06 32 | // Copyright: (c) ai-chan 33 | // Licence: 3-clause BSD 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | #include "cmd.hpp" // the header for this file 37 | #include 38 | // ---------------------------------------------------------------------------- 39 | // DrawCmd_M 40 | // ---------------------------------------------------------------------------- 41 | 42 | // constructor 43 | DrawCmd_M::DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev ) 44 | : DrawCmd ( x, y, ps, prev ) 45 | { 46 | type = M; 47 | } 48 | 49 | // to ASS drawing command 50 | wxString DrawCmd_M::ToString() 51 | { 52 | return wxString::Format(_T("m %d %d"), m_point->x(), m_point->y()); 53 | } 54 | 55 | 56 | 57 | // ---------------------------------------------------------------------------- 58 | // DrawCmd_L 59 | // ---------------------------------------------------------------------------- 60 | 61 | // constructor 62 | DrawCmd_L::DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev ) 63 | : DrawCmd ( x, y, ps, prev ) 64 | { 65 | type = L; 66 | } 67 | 68 | // to ASS drawing command 69 | wxString DrawCmd_L::ToString() 70 | { 71 | return wxString::Format(_T("l %d %d"), m_point->x(), m_point->y()); 72 | } 73 | 74 | 75 | 76 | // ---------------------------------------------------------------------------- 77 | // DrawCmd_B 78 | // ---------------------------------------------------------------------------- 79 | 80 | // constructor 81 | DrawCmd_B::DrawCmd_B 82 | ( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev ) 83 | : DrawCmd ( x, y, ps, prev ) 84 | { 85 | type = B; 86 | controlpoints.push_back( new Point(x1, y1, ps, CP, this, 1) ); 87 | controlpoints.push_back( new Point(x2, y2, ps, CP, this, 2) ); 88 | initialized = true; 89 | C1Cont = false; 90 | } 91 | 92 | // constructor 93 | DrawCmd_B::DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev ) 94 | : DrawCmd ( x, y, ps, prev ) 95 | { 96 | type = B; 97 | initialized = false; 98 | C1Cont = false; 99 | } 100 | 101 | // initialize; generate control points 102 | void DrawCmd_B::Init ( unsigned n ) 103 | { 104 | // Ignore if this is already initted 105 | if (initialized) return; 106 | 107 | wxPoint wx0 = prev->m_point->ToWxPoint(); 108 | wxPoint wx1 = m_point->ToWxPoint(); 109 | int xdiff = (wx1.x - wx0.x) / 3; 110 | int ydiff = (wx1.y - wx0.y) / 3; 111 | int xg, yg; 112 | 113 | // first control 114 | m_point->pointsys->FromWxPoint( wx0.x + xdiff, wx0.y + ydiff, xg, yg ); 115 | controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 1 ) ); 116 | 117 | // second control 118 | m_point->pointsys->FromWxPoint( wx1.x - xdiff, wx1.y - ydiff, xg, yg ); 119 | controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 2 ) ); 120 | 121 | initialized = true; 122 | 123 | } 124 | 125 | // to ASS drawing command 126 | wxString DrawCmd_B::ToString() 127 | { 128 | if (initialized) { 129 | PointList::iterator iterate = controlpoints.begin(); 130 | Point* c1 = (*iterate++); 131 | Point* c2 = (*iterate); 132 | return wxString::Format(_T("b %d %d %d %d %d %d"), c1->x(), c1->y(), c2->x(), c2->y(), m_point->x(), m_point->y()); 133 | } 134 | else 135 | return wxString::Format(_T("b ? ? ? ? %d %d"), m_point->x(), m_point->y()); 136 | } 137 | 138 | 139 | // ---------------------------------------------------------------------------- 140 | // DrawCmd_S 141 | // ---------------------------------------------------------------------------- 142 | 143 | // constructor 144 | DrawCmd_S::DrawCmd_S 145 | ( int x, int y, PointSystem *ps, DrawCmd *prev ) 146 | : DrawCmd ( x, y, ps, prev ) 147 | { 148 | type = S; 149 | initialized = false; 150 | closed = false; 151 | } 152 | 153 | // constructor 154 | DrawCmd_S::DrawCmd_S 155 | ( int x, int y, std::vector< int > vals, PointSystem *ps, DrawCmd *prev ) 156 | : DrawCmd ( x, y, ps, prev ) 157 | { 158 | type = S; 159 | std::vector< int >::iterator it = vals.begin(); 160 | unsigned n = 0; 161 | while (it != vals.end()) 162 | { 163 | int ix = *it; it++; 164 | int iy = *it; it++; 165 | n++; 166 | //::wxLogMessage(_T("%d %d\n"), ix, iy); 167 | controlpoints.push_back( new Point( ix, iy, ps, CP, this, n ) ); 168 | } 169 | 170 | initialized = true; 171 | closed = false; 172 | } 173 | 174 | // initialize; generate control points 175 | void DrawCmd_S::Init(unsigned n) 176 | { 177 | // Ignore if this is already initted 178 | if (initialized) return; 179 | 180 | wxPoint wx0 = prev->m_point->ToWxPoint(); 181 | wxPoint wx1 = m_point->ToWxPoint(); 182 | int xdiff = (wx1.x - wx0.x) / 3; 183 | int ydiff = (wx1.y - wx0.y) / 3; 184 | int xg, yg; 185 | 186 | // first control 187 | m_point->pointsys->FromWxPoint( wx0.x + xdiff, wx0.y + ydiff, xg, yg ); 188 | controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 1 ) ); 189 | 190 | // second control 191 | m_point->pointsys->FromWxPoint( wx1.x - xdiff, wx1.y - ydiff, xg, yg ); 192 | controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 2 ) ); 193 | 194 | initialized = true; 195 | 196 | } 197 | 198 | // to ASS drawing command 199 | wxString DrawCmd_S::ToString() 200 | { 201 | PointList::iterator iterate = controlpoints.begin(); 202 | wxString assout = _T("s"); 203 | for (; iterate != controlpoints.end(); iterate++) 204 | { 205 | if (initialized) 206 | assout = wxString::Format(_T("%s %d %d"), assout.c_str(), (*iterate)->x(), (*iterate)->y()); 207 | else 208 | assout = wxString::Format(_T("%s ? ?"), assout.c_str()); 209 | } 210 | assout = wxString::Format(_T("%s %d %d"), assout.c_str(), m_point->x(), m_point->y()); 211 | if (closed) assout = wxString::Format(_T("%s c"), assout.c_str()); 212 | return assout; 213 | } 214 | -------------------------------------------------------------------------------- /src/xpm/appico_xpm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | const char *appico_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 32 254 2", 5 | " c black", 6 | ". c #121508", 7 | "X c #1E1913", 8 | "o c #222200", 9 | "O c #252817", 10 | "+ c #313117", 11 | "@ c #15152A", 12 | "# c #2A002A", 13 | "$ c #3F003F", 14 | "% c #3F1F3F", 15 | "& c #332023", 16 | "* c #26392C", 17 | "= c #333223", 18 | "- c #322E36", 19 | "; c #2C3939", 20 | ": c #4D313F", 21 | "> c #55383E", 22 | ", c #555500", 23 | "< c #464F2B", 24 | "1 c #54542A", 25 | "2 c #4D4E3F", 26 | "3 c #575937", 27 | "4 c #5E672D", 28 | "5 c #6D7029", 29 | "6 c #362B56", 30 | "7 c #363571", 31 | "8 c #4C355F", 32 | "9 c #583B55", 33 | "0 c #443579", 34 | "q c #3C4575", 35 | "w c #4A4757", 36 | "e c #644D5D", 37 | "r c #6A5D5A", 38 | "t c #50624A", 39 | "y c #626448", 40 | "u c #626D51", 41 | "i c #787A55", 42 | "p c #554875", 43 | "a c #67537A", 44 | "s c #70517F", 45 | "d c #756C60", 46 | "f c #7F7C65", 47 | "g c #626D75", 48 | "h c #637479", 49 | "j c #AB713F", 50 | "k c #AF7D4C", 51 | "l c #8F7662", 52 | "z c #9C7277", 53 | "x c #E76F5B", 54 | "c c #81992A", 55 | "v c #D3B80F", 56 | "b c #EFBE0F", 57 | "n c #C1A821", 58 | "m c #F5CE11", 59 | "M c #DDCC22", 60 | "N c #90805C", 61 | "B c #97A447", 62 | "V c #8BBB4C", 63 | "C c #91B648", 64 | "Z c #99AA55", 65 | "A c #91BB5D", 66 | "S c #A5B859", 67 | "D c #8B8F65", 68 | "F c #959469", 69 | "G c #878B7D", 70 | "H c #989970", 71 | "J c #AB956B", 72 | "K c #BABC6D", 73 | "L c #ACA977", 74 | "P c #B8B376", 75 | "I c #C7814B", 76 | "U c #EB8D50", 77 | "Y c #DB8A69", 78 | "T c #DAA87A", 79 | "R c #A0C64B", 80 | "E c #BEC254", 81 | "W c #A9D058", 82 | "Q c #AEC96B", 83 | "! c #AAD071", 84 | "~ c #D1D647", 85 | "^ c #DBDF5C", 86 | "/ c #CCE252", 87 | "( c #D8ED5F", 88 | ") c #E5EC56", 89 | "_ c #E2F35A", 90 | "` c #FEFE59", 91 | "' c #CECF6F", 92 | "] c #C6D460", 93 | "[ c #D7DC65", 94 | "{ c #CFD47E", 95 | "} c #D5D879", 96 | "| c #CAE365", 97 | " . c #D3EB6C", 98 | ".. c #D0EA72", 99 | "X. c #E3E864", 100 | "o. c #EBF268", 101 | "O. c #FDFD66", 102 | "+. c #E3E976", 103 | "@. c #E8F376", 104 | "#. c #FDFD74", 105 | "$. c #3B3D8E", 106 | "%. c #3B3CA8", 107 | "&. c #413DB3", 108 | "*. c #554887", 109 | "=. c #405587", 110 | "-. c #494197", 111 | ";. c #544894", 112 | ":. c #5E5896", 113 | ">. c #654F9C", 114 | ",. c #655A9B", 115 | "<. c #785E98", 116 | "1. c #577494", 117 | "2. c #67718D", 118 | "3. c #78778A", 119 | "4. c #65639A", 120 | "5. c #756499", 121 | "6. c #667F99", 122 | "7. c #73769E", 123 | "8. c #4C4BB1", 124 | "9. c #6E5CA1", 125 | "0. c #745DA2", 126 | "q. c #615AB9", 127 | "w. c #6B66A8", 128 | "e. c #7B65A7", 129 | "r. c #797BA3", 130 | "t. c #6B66B7", 131 | "y. c #7565B2", 132 | "u. c #7A7BB5", 133 | "i. c #4443C6", 134 | "p. c #6E63CC", 135 | "a. c #796BC6", 136 | "s. c #7673C2", 137 | "d. c #6B64D8", 138 | "f. c #766DD7", 139 | "g. c #7C74D6", 140 | "h. c #7C74E0", 141 | "j. c #816CAF", 142 | "k. c #8964B8", 143 | "l. c #867AB6", 144 | "z. c #8479D8", 145 | "x. c #917BD3", 146 | "c. c #887BE7", 147 | "v. c #917BE8", 148 | "b. c #8D79F4", 149 | "n. c #987CF9", 150 | "m. c #6481A1", 151 | "M. c #7B83B8", 152 | "N. c #868289", 153 | "B. c #979D80", 154 | "V. c #888695", 155 | "C. c #8C929A", 156 | "Z. c #9A9898", 157 | "A. c #A69898", 158 | "S. c #98BF95", 159 | "D. c #B3AE8E", 160 | "F. c #B7B98C", 161 | "G. c #ACAB96", 162 | "H. c #B6B792", 163 | "J. c #8A88A8", 164 | "K. c #9285AA", 165 | "L. c #9996A3", 166 | "P. c #8480BE", 167 | "I. c #978EBC", 168 | "U. c #9E9DBA", 169 | "Y. c #A39BB6", 170 | "T. c #93B8B1", 171 | "R. c #A8A0A6", 172 | "E. c #B3A9AF", 173 | "W. c #B4B0A4", 174 | "Q. c #A8A6B6", 175 | "!. c #B3AFBF", 176 | "~. c #B9B6B6", 177 | "^. c #D3AC80", 178 | "/. c #DABC98", 179 | "(. c #E1AC82", 180 | "). c #FFBB89", 181 | "_. c #E9BD91", 182 | "`. c #C5B7A7", 183 | "'. c #BEC18C", 184 | "]. c #A6C19D", 185 | "[. c #98C6B1", 186 | "{. c #A4C7AA", 187 | "}. c #C8C385", 188 | "|. c #D1D28E", 189 | " X c #C7C998", 190 | ".X c #CCD59C", 191 | "XX c #FFC18C", 192 | "oX c #E9C994", 193 | "OX c #F4C890", 194 | "+X c #E9D198", 195 | "@X c #FFD698", 196 | "#X c #DAE082", 197 | "$X c #D8ED9A", 198 | "%X c #FFE19F", 199 | "&X c #F0F09E", 200 | "*X c #D5CEA3", 201 | "=X c #D9D9A5", 202 | "-X c #C7C3B8", 203 | ";X c #D4C8BB", 204 | ":X c #DCD8B8", 205 | ">X c #EBCAA2", 206 | ",X c #FADBA1", 207 | ".i.%.7 ,X,X,X6XZXZXoXx x Y ZXZX6X@X_.eXkXkXg.q.h.w. ", 285 | " p 9 ;.i.&.0 l >X2X6XZXZX6XoX_.5XZXZX6X2X/.0XkXc.t.q.t.9X ", 286 | " & *.i.&.0 6 6 K.-XVXAXZXZXZXZXZXZX4X`.:.z.kX8.8.p e 5. ", 287 | " -.i.%.9 6 6 &.8.w.V. XZXZX2XG.J.w.8.8.c.iX8.-.a > 9 ", 288 | " 7 %.7 X X 7 %.=.T.N I I j 1.1.$.7 8.c.t.%.6 - ", 289 | " ; $.B v c c t m.[.[.J U U k [.T.u H.Z.7Xg q t o ", 290 | " * v m m +.! [.bX[.k U U J ].4X 2) 82 | { 83 | if(m_closed) 84 | { 85 | m_spline_x.init(m_src_vertices.size() + 8); 86 | m_spline_y.init(m_src_vertices.size() + 8); 87 | m_spline_x.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).x); 88 | m_spline_y.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).y); 89 | m_spline_x.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].x); 90 | m_spline_y.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].y); 91 | m_spline_x.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].x); 92 | m_spline_y.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].y); 93 | m_spline_x.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].x); 94 | m_spline_y.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].y); 95 | } 96 | else 97 | { 98 | m_spline_x.init(m_src_vertices.size()); 99 | m_spline_y.init(m_src_vertices.size()); 100 | } 101 | unsigned i; 102 | for(i = 0; i < m_src_vertices.size(); i++) 103 | { 104 | double x = m_closed ? i + 4 : i; 105 | m_spline_x.add_point(x, m_src_vertices[i].x); 106 | m_spline_y.add_point(x, m_src_vertices[i].y); 107 | } 108 | m_cur_abscissa = 0.0; 109 | m_max_abscissa = m_src_vertices.size() - 1; 110 | if(m_closed) 111 | { 112 | m_cur_abscissa = 4.0; 113 | m_max_abscissa += 5.0; 114 | m_spline_x.add_point(m_src_vertices.size() + 4, m_src_vertices[0].x); 115 | m_spline_y.add_point(m_src_vertices.size() + 4, m_src_vertices[0].y); 116 | m_spline_x.add_point(m_src_vertices.size() + 5, m_src_vertices[1].x); 117 | m_spline_y.add_point(m_src_vertices.size() + 5, m_src_vertices[1].y); 118 | m_spline_x.add_point(m_src_vertices.size() + 6, m_src_vertices[2].x); 119 | m_spline_y.add_point(m_src_vertices.size() + 6, m_src_vertices[2].y); 120 | m_spline_x.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).x); 121 | m_spline_y.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).y); 122 | } 123 | m_spline_x.prepare(); 124 | m_spline_y.prepare(); 125 | } 126 | m_status = ready; 127 | } 128 | 129 | 130 | 131 | 132 | 133 | 134 | //------------------------------------------------------------------------ 135 | unsigned vcgen_bcspline::vertex(double* x, double* y) 136 | { 137 | unsigned cmd = path_cmd_line_to; 138 | while(!is_stop(cmd)) 139 | { 140 | switch(m_status) 141 | { 142 | case initial: 143 | rewind(0); 144 | 145 | case ready: 146 | if(m_src_vertices.size() < 2) 147 | { 148 | cmd = path_cmd_stop; 149 | break; 150 | } 151 | 152 | if(m_src_vertices.size() == 2) 153 | { 154 | *x = m_src_vertices[m_src_vertex].x; 155 | *y = m_src_vertices[m_src_vertex].y; 156 | m_src_vertex++; 157 | if(m_src_vertex == 1) return path_cmd_move_to; 158 | if(m_src_vertex == 2) return path_cmd_line_to; 159 | cmd = path_cmd_stop; 160 | break; 161 | } 162 | 163 | cmd = path_cmd_move_to; 164 | m_status = polygon; 165 | m_src_vertex = 0; 166 | 167 | case polygon: 168 | if(m_cur_abscissa >= m_max_abscissa) 169 | { 170 | if(m_closed) 171 | { 172 | m_status = end_poly; 173 | break; 174 | } 175 | else 176 | { 177 | *x = m_src_vertices[m_src_vertices.size() - 1].x; 178 | *y = m_src_vertices[m_src_vertices.size() - 1].y; 179 | m_status = end_poly; 180 | return path_cmd_line_to; 181 | } 182 | } 183 | 184 | *x = m_spline_x.get(m_cur_abscissa); 185 | *y = m_spline_y.get(m_cur_abscissa); 186 | m_src_vertex++; 187 | m_cur_abscissa += m_interpolation_step; 188 | return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to; 189 | 190 | case end_poly: 191 | m_status = stop; 192 | return path_cmd_end_poly | m_closed; 193 | 194 | case stop: 195 | return path_cmd_stop; 196 | } 197 | } 198 | return cmd; 199 | } 200 | 201 | 202 | } 203 | 204 | -------------------------------------------------------------------------------- /src/assdraw_settings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | #include "assdraw.hpp" 30 | 31 | void ASSDrawFrame::InitializeDefaultSettings() 32 | { 33 | colors.canvas_bg = wxColour(0xFF, 0xFF, 0xFF); 34 | colors.canvas_shape_normal = wxColour(0x0, 0x0, 0xFF, 0x99); 35 | colors.canvas_shape_preview = wxColour(0x0, 0x0, 0xFF); 36 | colors.canvas_shape_outline = wxColour(0x0, 0x0, 0x0); 37 | colors.canvas_shape_guideline = wxColour(0x66, 0x66, 0x66); 38 | colors.canvas_shape_mainpoint = wxColour(0xFF, 0x0, 0x0, 0xCC); 39 | colors.canvas_shape_controlpoint = wxColour(0x0, 0xFF, 0x0, 0xCC); 40 | colors.canvas_shape_selectpoint = wxColour(0x0, 0x0, 0xCC); 41 | colors.library_shape = wxColour(0x0, 0x66, 0x99); 42 | colors.library_libarea = wxColour(0xFF, 0xFF, 0x99); 43 | colors.origin = wxColour(0xFF, 0x0, 0x0); 44 | colors.ruler_h = wxColour(0x0, 0x0, 0x66); 45 | colors.ruler_v = wxColour(0x66, 0x0, 0x0); 46 | 47 | alphas.canvas_shape_normal = 128; 48 | alphas.canvas_shape_preview = 255; 49 | alphas.canvas_shape_outline = 255; 50 | alphas.canvas_shape_guideline = 255; 51 | alphas.canvas_shape_mainpoint = 128; 52 | alphas.canvas_shape_controlpoint = 128; 53 | alphas.canvas_shape_selectpoint = 255; 54 | 55 | sizes.origincross = 2; 56 | 57 | behaviors.capitalizecmds = false; 58 | behaviors.autoaskimgopac = true; 59 | behaviors.parse_spc = false; 60 | behaviors.nosplashscreen = false; 61 | behaviors.confirmquit = true; 62 | } 63 | 64 | void ASSDrawFrame::ApplySettings() 65 | { 66 | wxColourSetAlpha(colors.canvas_shape_normal, alphas.canvas_shape_normal); 67 | wxColourSetAlpha(colors.canvas_shape_preview, alphas.canvas_shape_preview); 68 | wxColourSetAlpha(colors.canvas_shape_outline, alphas.canvas_shape_outline); 69 | wxColourSetAlpha(colors.canvas_shape_guideline, alphas.canvas_shape_guideline); 70 | wxColourSetAlpha(colors.canvas_shape_mainpoint, alphas.canvas_shape_mainpoint); 71 | wxColourSetAlpha(colors.canvas_shape_controlpoint, alphas.canvas_shape_controlpoint); 72 | wxColourSetAlpha(colors.canvas_shape_selectpoint, alphas.canvas_shape_selectpoint); 73 | 74 | wxColourToAggRGBA(colors.canvas_shape_normal, m_canvas->rgba_shape_normal); 75 | wxColourToAggRGBA(colors.canvas_shape_preview, m_canvas->rgba_shape); 76 | wxColourToAggRGBA(colors.canvas_shape_outline, m_canvas->rgba_outline); 77 | wxColourToAggRGBA(colors.canvas_shape_guideline, m_canvas->rgba_guideline); 78 | wxColourToAggRGBA(colors.canvas_shape_mainpoint, m_canvas->rgba_mainpoint); 79 | wxColourToAggRGBA(colors.canvas_shape_controlpoint, m_canvas->rgba_controlpoint); 80 | wxColourToAggRGBA(colors.canvas_shape_selectpoint, m_canvas->rgba_selectpoint); 81 | wxColourToAggRGBA(colors.origin, m_canvas->rgba_origin); 82 | wxColourToAggRGBA(colors.ruler_h, m_canvas->rgba_ruler_h); 83 | wxColourToAggRGBA(colors.ruler_v, m_canvas->rgba_ruler_v); 84 | 85 | m_canvas->color_bg.r = colors.canvas_bg.Red(); 86 | m_canvas->color_bg.g = colors.canvas_bg.Green(); 87 | m_canvas->color_bg.b = colors.canvas_bg.Blue(); 88 | m_canvas->color_bg.a = colors.canvas_bg.Alpha(); 89 | m_canvas->PrepareBackgroundBitmap(-1.0); 90 | m_canvas->Refresh(); 91 | 92 | shapelib->libarea->SetBackgroundColour(colors.library_libarea); 93 | typedef std::vector< ASSDrawShapePreview *> PrevVec; 94 | PrevVec shapes = shapelib->GetShapePreviews(); 95 | int n = shapes.size(); 96 | for (int i = 0; i < n; i++) 97 | wxColourToAggRGBA(colors.library_shape, shapes[i]->rgba_shape); 98 | shapelib->libarea->Refresh(); 99 | 100 | m_canvas->SetDrawCmdSet(behaviors.parse_spc? _T("m n l b s p c _"):_T("m n l b _")); 101 | 102 | UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS()); 103 | } 104 | 105 | void ASSDrawFrame::wxColourToAggRGBA(wxColour &colour, agg::rgba &rgba) 106 | { 107 | rgba.r = (double) colour.Red() / 255.0; 108 | rgba.g = (double) colour.Green() / 255.0; 109 | rgba.b = (double) colour.Blue() / 255.0; 110 | rgba.a = (double) colour.Alpha() / 255.0; 111 | } 112 | 113 | void ASSDrawFrame::wxColourSetAlpha(wxColour &colour, long alpha) 114 | { 115 | colour.Set(colour.Red(), colour.Green(), colour.Blue(), alpha); 116 | } 117 | 118 | void ASSDrawFrame::OnSettingsChanged(wxCommandEvent& event) 119 | { 120 | ApplySettings(); 121 | } 122 | 123 | void ASSDrawFrame::LoadSettings() 124 | { 125 | #define CFGREADCOLOR(color) if (config->Read(wxString(#color,wxConvUTF8), &tmpstr)) color.Set(tmpstr); 126 | #define CFGREAD(var) config->Read(wxString(#var,wxConvUTF8), &var); 127 | config->SetPath(_T("settings")); 128 | wxString tmpstr; 129 | CFGREADCOLOR(colors.canvas_bg) 130 | CFGREADCOLOR(colors.canvas_shape_normal) 131 | CFGREADCOLOR(colors.canvas_shape_preview) 132 | CFGREADCOLOR(colors.canvas_shape_controlpoint) 133 | CFGREADCOLOR(colors.canvas_shape_guideline) 134 | CFGREADCOLOR(colors.canvas_shape_mainpoint) 135 | CFGREADCOLOR(colors.canvas_shape_outline) 136 | CFGREADCOLOR(colors.canvas_shape_selectpoint) 137 | CFGREADCOLOR(colors.library_libarea) 138 | CFGREADCOLOR(colors.library_shape) 139 | CFGREADCOLOR(colors.origin) 140 | CFGREADCOLOR(colors.ruler_h) 141 | CFGREADCOLOR(colors.ruler_v) 142 | CFGREAD(alphas.canvas_shape_normal) 143 | CFGREAD(alphas.canvas_shape_preview) 144 | CFGREAD(alphas.canvas_shape_controlpoint) 145 | CFGREAD(alphas.canvas_shape_guideline) 146 | CFGREAD(alphas.canvas_shape_mainpoint) 147 | CFGREAD(alphas.canvas_shape_outline) 148 | CFGREAD(alphas.canvas_shape_selectpoint) 149 | CFGREAD(sizes.origincross) 150 | CFGREAD(behaviors.autoaskimgopac) 151 | CFGREAD(behaviors.capitalizecmds) 152 | CFGREAD(behaviors.parse_spc) 153 | CFGREAD(behaviors.nosplashscreen) 154 | CFGREAD(behaviors.confirmquit) 155 | config->SetPath(_T("..")); 156 | } 157 | 158 | void ASSDrawFrame::SaveSettings() 159 | { 160 | #define CFGWRITE(var) config->Write(wxString(#var,wxConvUTF8), var); 161 | #define CFGWRITECOLOR(color) config->Write(wxString(#color,wxConvUTF8), color.GetAsString(wxC2S_CSS_SYNTAX)); 162 | config->SetPath(_T("settings")); 163 | CFGWRITECOLOR(colors.canvas_bg) 164 | CFGWRITECOLOR(colors.canvas_shape_normal) 165 | CFGWRITECOLOR(colors.canvas_shape_preview) 166 | CFGWRITECOLOR(colors.canvas_shape_controlpoint) 167 | CFGWRITECOLOR(colors.canvas_shape_guideline) 168 | CFGWRITECOLOR(colors.canvas_shape_mainpoint) 169 | CFGWRITECOLOR(colors.canvas_shape_outline) 170 | CFGWRITECOLOR(colors.canvas_shape_selectpoint) 171 | CFGWRITECOLOR(colors.library_libarea) 172 | CFGWRITECOLOR(colors.library_shape) 173 | CFGWRITECOLOR(colors.origin) 174 | CFGWRITECOLOR(colors.ruler_h) 175 | CFGWRITECOLOR(colors.ruler_v) 176 | CFGWRITE(alphas.canvas_shape_normal) 177 | CFGWRITE(alphas.canvas_shape_preview) 178 | CFGWRITE(alphas.canvas_shape_controlpoint) 179 | CFGWRITE(alphas.canvas_shape_guideline) 180 | CFGWRITE(alphas.canvas_shape_mainpoint) 181 | CFGWRITE(alphas.canvas_shape_outline) 182 | CFGWRITE(alphas.canvas_shape_selectpoint) 183 | CFGWRITE(sizes.origincross) 184 | CFGWRITE(behaviors.autoaskimgopac) 185 | CFGWRITE(behaviors.capitalizecmds) 186 | CFGWRITE(behaviors.parse_spc) 187 | CFGWRITE(behaviors.nosplashscreen) 188 | CFGWRITE(behaviors.confirmquit) 189 | config->SetPath(_T("..")); 190 | } 191 | -------------------------------------------------------------------------------- /src/agg_bcspline.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry (AGG) - Version 2.5 3 | // A high quality rendering engine for C++ 4 | // Copyright (C) 2002-2006 Maxim Shemanarev 5 | // Contact: mcseem@antigrain.com 6 | // mcseemagg@yahoo.com 7 | // http://antigrain.com 8 | // 9 | // AGG is free software; you can redistribute it and/or 10 | // modify it under the terms of the GNU General Public License 11 | // as published by the Free Software Foundation; either version 2 12 | // of the License, or (at your option) any later version. 13 | // 14 | // AGG is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with AGG; if not, write to the Free Software 21 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | // MA 02110-1301, USA. 23 | //---------------------------------------------------------------------------- 24 | 25 | #include "agg_bcspline.h" 26 | 27 | namespace agg 28 | { 29 | //------------------------------------------------------------------------ 30 | bcspline::bcspline() : 31 | m_max(0), 32 | m_num(0), 33 | m_x(0), 34 | m_y(0), 35 | m_last_idx(-1) 36 | { 37 | } 38 | 39 | //------------------------------------------------------------------------ 40 | bcspline::bcspline(int num) : 41 | m_max(0), 42 | m_num(0), 43 | m_x(0), 44 | m_y(0), 45 | m_last_idx(-1) 46 | { 47 | init(num); 48 | } 49 | 50 | //------------------------------------------------------------------------ 51 | bcspline::bcspline(int num, const double* x, const double* y) : 52 | m_max(0), 53 | m_num(0), 54 | m_x(0), 55 | m_y(0), 56 | m_last_idx(-1) 57 | { 58 | init(num, x, y); 59 | } 60 | 61 | 62 | //------------------------------------------------------------------------ 63 | void bcspline::init(int max) 64 | { 65 | if(max > 2 && max > m_max) 66 | { 67 | m_am.resize(max * 3); 68 | m_max = max; 69 | m_x = &m_am[m_max]; 70 | m_y = &m_am[m_max * 2]; 71 | } 72 | m_num = 0; 73 | m_last_idx = -1; 74 | } 75 | 76 | 77 | //------------------------------------------------------------------------ 78 | void bcspline::add_point(double x, double y) 79 | { 80 | if(m_num < m_max) 81 | { 82 | m_x[m_num] = x; 83 | m_y[m_num] = y; 84 | ++m_num; 85 | } 86 | } 87 | 88 | 89 | //------------------------------------------------------------------------ 90 | void bcspline::prepare() 91 | { 92 | if(m_num > 2) 93 | { 94 | int i, k, n1; 95 | double* temp; 96 | double* r; 97 | double* s; 98 | double h, p, d, f, e; 99 | 100 | for(k = 0; k < m_num; k++) 101 | { 102 | m_am[k] = 0.0; 103 | } 104 | 105 | n1 = 3 * m_num; 106 | 107 | pod_array al(n1); 108 | temp = &al[0]; 109 | 110 | for(k = 0; k < n1; k++) 111 | { 112 | temp[k] = 0.0; 113 | } 114 | 115 | r = temp + m_num; 116 | s = temp + m_num * 2; 117 | 118 | n1 = m_num - 1; 119 | d = m_x[1] - m_x[0]; 120 | e = (m_y[1] - m_y[0]) / d; 121 | 122 | for(k = 1; k < n1; k++) 123 | { 124 | h = d; 125 | d = m_x[k + 1] - m_x[k]; 126 | f = e; 127 | e = (m_y[k + 1] - m_y[k]) / d; 128 | al[k] = d / (d + h); 129 | r[k] = 1.0 - al[k]; 130 | s[k] = 6.0 * (e - f) / (h + d); 131 | } 132 | 133 | for(k = 1; k < n1; k++) 134 | { 135 | p = 1.0 / (r[k] * al[k - 1] + 2.0); 136 | al[k] *= -p; 137 | s[k] = (s[k] - r[k] * s[k - 1]) * p; 138 | } 139 | 140 | m_am[n1] = 0.0; 141 | al[n1 - 1] = s[n1 - 1]; 142 | m_am[n1 - 1] = al[n1 - 1]; 143 | 144 | for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--) 145 | { 146 | al[k] = al[k] * al[k + 1] + s[k]; 147 | m_am[k] = al[k]; 148 | } 149 | } 150 | m_last_idx = -1; 151 | } 152 | 153 | 154 | 155 | //------------------------------------------------------------------------ 156 | void bcspline::init(int num, const double* x, const double* y) 157 | { 158 | if(num > 2) 159 | { 160 | init(num); 161 | int i; 162 | for(i = 0; i < num; i++) 163 | { 164 | add_point(*x++, *y++); 165 | } 166 | prepare(); 167 | } 168 | m_last_idx = -1; 169 | } 170 | 171 | 172 | //------------------------------------------------------------------------ 173 | void bcspline::bsearch(int n, const double *x, double x0, int *i) 174 | { 175 | int j = n - 1; 176 | int k; 177 | 178 | for(*i = 0; (j - *i) > 1; ) 179 | { 180 | if(x0 < x[k = (*i + j) >> 1]) j = k; 181 | else *i = k; 182 | } 183 | } 184 | 185 | 186 | 187 | //------------------------------------------------------------------------ 188 | double bcspline::interpolation(double x, int i) const 189 | { 190 | int j = i + 1; 191 | double d = m_x[i] - m_x[j]; 192 | double h = x - m_x[j]; 193 | double r = m_x[i] - x; 194 | double p = d * d / 6.0; 195 | return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d + 196 | ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d; 197 | } 198 | 199 | 200 | //------------------------------------------------------------------------ 201 | double bcspline::extrapolation_left(double x) const 202 | { 203 | double d = m_x[1] - m_x[0]; 204 | return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) * 205 | (x - m_x[0]) + 206 | m_y[0]; 207 | } 208 | 209 | //------------------------------------------------------------------------ 210 | double bcspline::extrapolation_right(double x) const 211 | { 212 | double d = m_x[m_num - 1] - m_x[m_num - 2]; 213 | return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) * 214 | (x - m_x[m_num - 1]) + 215 | m_y[m_num - 1]; 216 | } 217 | 218 | //------------------------------------------------------------------------ 219 | double bcspline::get(double x) const 220 | { 221 | if(m_num > 2) 222 | { 223 | int i; 224 | 225 | // Extrapolation on the left 226 | if(x < m_x[0]) return extrapolation_left(x); 227 | 228 | // Extrapolation on the right 229 | if(x >= m_x[m_num - 1]) return extrapolation_right(x); 230 | 231 | // Interpolation 232 | bsearch(m_num, m_x, x, &i); 233 | return interpolation(x, i); 234 | } 235 | return 0.0; 236 | } 237 | 238 | 239 | //------------------------------------------------------------------------ 240 | double bcspline::get_stateful(double x) const 241 | { 242 | if(m_num > 2) 243 | { 244 | // Extrapolation on the left 245 | if(x < m_x[0]) return extrapolation_left(x); 246 | 247 | // Extrapolation on the right 248 | if(x >= m_x[m_num - 1]) return extrapolation_right(x); 249 | 250 | if(m_last_idx >= 0) 251 | { 252 | // Check if x is not in current range 253 | if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1]) 254 | { 255 | // Check if x between next points (most probably) 256 | if(m_last_idx < m_num - 2 && 257 | x >= m_x[m_last_idx + 1] && 258 | x <= m_x[m_last_idx + 2]) 259 | { 260 | ++m_last_idx; 261 | } 262 | else 263 | if(m_last_idx > 0 && 264 | x >= m_x[m_last_idx - 1] && 265 | x <= m_x[m_last_idx]) 266 | { 267 | // x is between pevious points 268 | --m_last_idx; 269 | } 270 | else 271 | { 272 | // Else perform full search 273 | bsearch(m_num, m_x, x, &m_last_idx); 274 | } 275 | } 276 | return interpolation(x, m_last_idx); 277 | } 278 | else 279 | { 280 | // Interpolation 281 | bsearch(m_num, m_x, x, &m_last_idx); 282 | return interpolation(x, m_last_idx); 283 | } 284 | } 285 | return 0.0; 286 | } 287 | 288 | } 289 | 290 | -------------------------------------------------------------------------------- /src/library.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include "assdraw.hpp" 29 | #include "library.hpp" 30 | 31 | #include 32 | 33 | #if !defined(__WINDOWS__) 34 | #include "xpm/res.h" 35 | #endif 36 | 37 | BEGIN_EVENT_TABLE(ASSDrawShapePreview, ASSDrawEngine) 38 | EVT_SIZE(ASSDrawShapePreview::OnSize) 39 | END_EVENT_TABLE() 40 | 41 | ASSDrawShapePreview::ASSDrawShapePreview( wxWindow *parent, ASSDrawShapeLibrary *_shapelib, wxString initialcmds ) 42 | : ASSDrawEngine(parent, wxSIMPLE_BORDER) 43 | { 44 | shapelib = _shapelib; 45 | if (ParseASS(initialcmds) > 0) 46 | SetFitToViewPointOnNextPaint(5, 5); 47 | cb = new wxCheckBox(this, wxID_ANY, _T("")); 48 | } 49 | 50 | void ASSDrawShapePreview::OnSize(wxSizeEvent& event) 51 | { 52 | return; 53 | wxSize siz = event.GetSize(); 54 | 55 | if (shapelib->layout == HORIZONTAL) 56 | SetSize(siz.x, siz.x); 57 | else 58 | SetSize(siz.y, siz.y); 59 | SetFitToViewPointOnNextPaint(10, 10); 60 | } 61 | 62 | BEGIN_EVENT_TABLE(ASSDrawShapeLibrary, wxScrolledWindow) 63 | EVT_SIZE(ASSDrawShapeLibrary::OnSize) 64 | EVT_MENU_RANGE(MENU_RANGE_START, MENU_RANGE_END, ASSDrawShapeLibrary::OnPopupMenuClicked) 65 | EVT_TOOL(TOOL_SAVE, ASSDrawShapeLibrary::SaveShapeFromCanvas) 66 | EVT_TOOL_RANGE(TOOL_CHECK, TOOL_UNCHECK, ASSDrawShapeLibrary::CheckUncheckAllPreviews) 67 | EVT_TOOL(TOOL_DELETE, ASSDrawShapeLibrary::DeleteChecked) 68 | END_EVENT_TABLE() 69 | 70 | ASSDrawShapeLibrary::ASSDrawShapeLibrary( wxWindow *parent, ASSDrawFrame *frame ) 71 | : wxScrolledWindow(parent, wxID_ANY) 72 | { 73 | m_frame = frame; 74 | //sizer = NULL; 75 | layout = VERTICAL; 76 | 77 | wxToolBar *tbar = new wxToolBar(this, wxID_ANY, __DPDS__ , wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT | wxTB_NODIVIDER); 78 | tbar->SetMargins(0, 3); 79 | tbar->AddTool(TOOL_SAVE, _T("Save canvas"), wxBITMAP(add)); 80 | tbar->AddSeparator(); 81 | tbar->AddTool(TOOL_CHECK, _T("Select all"), wxBITMAP(check)); 82 | tbar->AddTool(TOOL_UNCHECK, _T("Select none"), wxBITMAP(uncheck)); 83 | tbar->AddTool(TOOL_DELETE, _T("Delete selected"), wxBITMAP(delcross)); 84 | 85 | libarea = new wxScrolledWindow(this, wxID_ANY, __DPDS__ , wxScrolledWindowStyle | wxSIMPLE_BORDER); 86 | libarea->SetBackgroundColour(wxColour(0xFF, 0xFF, 0x99)); 87 | sizer = new wxFlexGridSizer(0, 1, 0, 0); 88 | ((wxFlexGridSizer*) sizer)->AddGrowableCol(0); 89 | libarea->SetSizer(sizer); 90 | libarea->SetScrollbars(20, 20, 50, 50); 91 | libsizer = new wxFlexGridSizer(2, 1, 0, 0); 92 | libsizer->AddGrowableCol(0); 93 | libsizer->AddGrowableRow(1); 94 | libsizer->Add(tbar, 0, wxBOTTOM, 2); 95 | libsizer->Add(libarea,1,wxEXPAND); 96 | tbar->Realize(); 97 | libsizer->Layout(); 98 | 99 | SetSizer(libsizer); 100 | } 101 | 102 | void ASSDrawShapeLibrary::OnSize(wxSizeEvent& event) 103 | { 104 | if (sizer == NULL || sizer->GetChildren().size() == 0) return; 105 | 106 | wxSize siz = GetClientSize(); 107 | libsizer->SetDimension(0, 0, siz.x, siz.y); 108 | 109 | UpdatePreviewDisplays(); 110 | } 111 | 112 | ASSDrawShapePreview* ASSDrawShapeLibrary::AddShapePreview(wxString cmds, bool addtotop) 113 | { 114 | ASSDrawShapePreview *prev = new ASSDrawShapePreview(libarea, this, cmds); 115 | prev->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(ASSDrawShapeLibrary::OnMouseLeftDClick), NULL, this); 116 | prev->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(ASSDrawShapeLibrary::OnMouseRightClick), NULL, this); 117 | ASSDrawFrame::wxColourToAggRGBA(m_frame->colors.library_shape, prev->rgba_shape); 118 | if (addtotop) 119 | sizer->Insert(0, prev, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); 120 | else 121 | sizer->Add(prev, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); 122 | UpdatePreviewDisplays(); 123 | return prev; 124 | } 125 | 126 | void ASSDrawShapeLibrary::UpdatePreviewDisplays() 127 | { 128 | wxSize siz = GetClientSize(); 129 | int dim = siz.x - 15; 130 | libarea->Show(false); 131 | wxwxSizerItemListNode *node = sizer->GetChildren().GetFirst(); 132 | while (node != NULL) 133 | { 134 | ASSDrawShapePreview *shprvw = (ASSDrawShapePreview *) node->GetData()->GetWindow(); 135 | shprvw->SetSize(dim, dim); 136 | sizer->SetItemMinSize(shprvw, dim - 20, dim - 20); 137 | shprvw->SetFitToViewPointOnNextPaint(10, 10); 138 | shprvw->Refresh(); 139 | node = node->GetNext(); 140 | } 141 | sizer->Layout(); 142 | sizer->FitInside(libarea); 143 | libarea->Show(true); 144 | } 145 | 146 | void ASSDrawShapeLibrary::OnMouseLeftDClick(wxMouseEvent &event) 147 | { 148 | ASSDrawShapePreview *preview = (ASSDrawShapePreview *) event.GetEventObject(); 149 | LoadToCanvas(preview); 150 | } 151 | 152 | void ASSDrawShapeLibrary::OnMouseRightClick(wxMouseEvent &event) 153 | { 154 | ASSDrawShapePreview *prev = (ASSDrawShapePreview *) event.GetEventObject(); 155 | if (prev && prev->shapelib == this) 156 | { 157 | activepreview = prev; 158 | wxMenu *menu = new wxMenu; 159 | wxMenuItem *menuload = new wxMenuItem(menu, MENU_LOAD, _T("Load to canvas")); 160 | #ifdef __WINDOWS__ 161 | wxFont f = menuload->GetFont(); 162 | f.SetWeight(wxFONTWEIGHT_BOLD); 163 | menuload->SetFont(f); 164 | #endif 165 | menu->Append(menuload); 166 | //menu->Append(MENU_LOAD, _T("Load to canvas"))->GetFont().SetWeight(wxFONTWEIGHT_BOLD); 167 | menu->Append(MENU_COPYCLIPBOARD, _T("Copy commands to clipboard")); 168 | menu->Append(MENU_SAVECANVAS, _T("Save canvas here")); 169 | wxMenu *submenu = new wxMenu; 170 | submenu->Append(MENU_DELETE, _T("Confirm delete?")); 171 | menu->Append(MENU_DUMMY, _T("Delete from library"), submenu); 172 | PopupMenu(menu); 173 | delete menu; 174 | } 175 | } 176 | 177 | void ASSDrawShapeLibrary::OnPopupMenuClicked(wxCommandEvent &event) 178 | { 179 | int id = event.GetId(); 180 | switch(id) 181 | { 182 | case MENU_LOAD: 183 | LoadToCanvas(activepreview); 184 | break; 185 | case MENU_COPYCLIPBOARD: 186 | if (wxTheClipboard->Open()) 187 | { 188 | if (wxTheClipboard->IsSupported( wxDF_TEXT )) 189 | { 190 | wxTheClipboard->SetData( new wxTextDataObject( activepreview->GenerateASS() ) ); 191 | } 192 | wxTheClipboard->Close(); 193 | } 194 | break; 195 | case MENU_SAVECANVAS: 196 | activepreview->ParseASS(m_frame->m_canvas->GenerateASS()); 197 | activepreview->SetFitToViewPointOnNextPaint(); 198 | activepreview->RefreshDisplay(); 199 | break; 200 | case MENU_DELETE: 201 | sizer->Detach(activepreview); 202 | activepreview->Show(false); 203 | activepreview->Destroy(); 204 | UpdatePreviewDisplays(); 205 | Refresh(); 206 | break; 207 | } 208 | } 209 | 210 | void ASSDrawShapeLibrary::SaveShapeFromCanvas(wxCommandEvent& WXUNUSED(event)) 211 | { 212 | AddShapePreview(m_frame->m_canvas->GenerateASS(), true); 213 | } 214 | 215 | void ASSDrawShapeLibrary::CheckUncheckAllPreviews(wxCommandEvent &event) 216 | { 217 | bool checked = event.GetId() == TOOL_CHECK; 218 | wxwxSizerItemListNode *node = sizer->GetChildren().GetFirst(); 219 | while (node != NULL) 220 | { 221 | ASSDrawShapePreview *shprvw = (ASSDrawShapePreview *) node->GetData()->GetWindow(); 222 | shprvw->cb->SetValue(checked); 223 | node = node->GetNext(); 224 | } 225 | } 226 | 227 | void ASSDrawShapeLibrary::DeleteChecked(wxCommandEvent& WXUNUSED(event)) 228 | { 229 | wxwxSizerItemListNode *node = sizer->GetChildren().GetFirst(); 230 | while (node != NULL) 231 | { 232 | ASSDrawShapePreview *shprvw = (ASSDrawShapePreview *) node->GetData()->GetWindow(); 233 | if (shprvw->cb->GetValue()) 234 | { 235 | sizer->Detach(shprvw); 236 | shprvw->Show(false); 237 | shprvw->Destroy(); 238 | } 239 | node = node->GetNext(); 240 | } 241 | UpdatePreviewDisplays(); 242 | Refresh(); 243 | } 244 | 245 | std::vector< ASSDrawShapePreview *> ASSDrawShapeLibrary::GetShapePreviews() 246 | { 247 | std::vector< ASSDrawShapePreview *> out; 248 | wxwxSizerItemListNode *node = sizer->GetChildren().GetFirst(); 249 | while (node != NULL) 250 | { 251 | ASSDrawShapePreview *shprvw = (ASSDrawShapePreview *) node->GetData()->GetWindow(); 252 | out.push_back(shprvw); 253 | node = node->GetNext(); 254 | } 255 | return out; 256 | } 257 | 258 | void ASSDrawShapeLibrary::LoadToCanvas(ASSDrawShapePreview *preview) 259 | { 260 | m_frame->m_canvas->AddUndo(_T("Load shape from library")); 261 | m_frame->m_canvas->ParseASS(preview->GenerateASS()); 262 | m_frame->m_canvas->RefreshDisplay(); 263 | m_frame->m_canvas->RefreshUndocmds(); 264 | m_frame->UpdateFrameUI(); 265 | } 266 | -------------------------------------------------------------------------------- /assdraw_2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 29 | 32 | 35 | 38 | 41 | 44 | 56 | 59 | 62 | 65 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 104 | 107 | 110 | 113 | 116 | 120 | 132 | 135 | 138 | 141 | 151 | 154 | 157 | 160 | 163 | 166 | 169 | 172 | 173 | 181 | 184 | 187 | 190 | 193 | 196 | 205 | 208 | 211 | 214 | 226 | 229 | 232 | 235 | 238 | 241 | 244 | 247 | 248 | 256 | 259 | 262 | 265 | 268 | 272 | 281 | 284 | 287 | 290 | 302 | 305 | 308 | 311 | 314 | 317 | 320 | 323 | 324 | 325 | 326 | 327 | 328 | 333 | 336 | 337 | 340 | 341 | 344 | 345 | 348 | 349 | 352 | 353 | 356 | 357 | 360 | 361 | 364 | 365 | 368 | 369 | 372 | 373 | 376 | 377 | 380 | 381 | 382 | 387 | 390 | 391 | 394 | 395 | 398 | 399 | 402 | 403 | 406 | 407 | 410 | 411 | 414 | 415 | 418 | 419 | 422 | 423 | 426 | 427 | 430 | 431 | 434 | 435 | 438 | 439 | 442 | 443 | 446 | 447 | 450 | 451 | 454 | 455 | 458 | 459 | 460 | 465 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | -------------------------------------------------------------------------------- /src/canvas.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Name: canvas.hpp 29 | // Purpose: header file for ASSDraw main canvas class 30 | // Author: ai-chan 31 | // Created: 08/26/06 32 | // Copyright: (c) ai-chan 33 | // Licence: 3-clause BSD 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | #pragma once 37 | 38 | #include 39 | 40 | #include "engine.hpp" 41 | #include "enums.hpp" 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | #include "agg_span_allocator.h" 48 | #include "agg_span_interpolator_linear.h" 49 | #include "agg_span_image_filter_rgb.h" 50 | #include "agg_span_image_filter_rgba.h" 51 | #include "agg_image_accessors.h" 52 | #include "agg_conv_clip_polygon.h" 53 | 54 | class ASSDrawFrame; 55 | class ASSDrawCanvas; 56 | 57 | struct UndoRedo 58 | { 59 | wxString cmds; 60 | wxString desc; 61 | double originx, originy, scale; 62 | 63 | std::vector< bool > c1cont; 64 | wxString bgimgfile; 65 | wxRealPoint bgdisp, bgcenter; 66 | double bgscale, bgalpha; 67 | 68 | MODE draw_mode; 69 | agg::path_storage backupcmds; 70 | wxRealPoint rectbound[4], rectbound2[4], backup[4]; 71 | bool isshapetransformable; 72 | 73 | void Import(ASSDrawCanvas *canvas, bool prestage, wxString cmds = _T("")); 74 | void Export(ASSDrawCanvas *canvas); 75 | 76 | }; 77 | 78 | // for multiple point selection 79 | enum SELECTMODE { NEW, ADD, DEL }; 80 | 81 | class ASSDrawCanvas: public ASSDrawEngine, public wxClientData 82 | { 83 | public: 84 | ASSDrawCanvas( wxWindow *parent, ASSDrawFrame *frame, int extraflags = 0 ); 85 | 86 | // destructor 87 | ~ASSDrawCanvas(); 88 | 89 | virtual void ResetEngine(bool addM); 90 | virtual void SetPreviewMode( bool mode ); 91 | virtual bool IsPreviewMode() { return preview_mode; } 92 | virtual void ParseASS(wxString str, bool addundo = false); 93 | 94 | virtual void SetDrawMode( MODE mode ); 95 | virtual MODE GetDrawMode() { return draw_mode; } 96 | virtual bool IsTransformMode(); 97 | virtual void SetDragMode( DRAGMODE mode ); 98 | virtual DRAGMODE GetDragMode() { return drag_mode; } 99 | virtual void RefreshDisplay(); 100 | virtual bool CanZoom(); 101 | virtual bool CanMove(); 102 | 103 | virtual void OnMouseMove(wxMouseEvent &event); 104 | virtual void OnMouseLeftUp(wxMouseEvent &event); 105 | virtual void OnMouseLeftDown(wxMouseEvent &event); 106 | virtual void OnMouseRightUp(wxMouseEvent &event); 107 | virtual void OnMouseRightDown(wxMouseEvent &event); 108 | virtual void OnMouseRightDClick(wxMouseEvent &event); 109 | virtual void OnMouseWheel(wxMouseEvent &event); 110 | virtual void CustomOnKeyDown(wxKeyEvent &event); 111 | virtual void CustomOnKeyUp(wxKeyEvent &event); 112 | virtual void ChangeZoomLevel(double zoomamount, wxPoint bgzoomctr); 113 | virtual void ChangeZoomLevelTo(double zoom, wxPoint bgzoomctr); 114 | virtual void ChangeDrawingZoomLevel(double zoom); 115 | virtual void ChangeBackgroundZoomLevel(double zoom, wxRealPoint newcenter); 116 | virtual void MoveCanvas(double xamount, double yamount); 117 | virtual void MoveCanvasOriginTo(double originx, double originy); 118 | virtual void MoveCanvasDrawing(double xamount, double yamount); 119 | virtual void MoveCanvasBackground(double xamount, double yamount); 120 | virtual void OnSelect_ConvertLineToBezier(wxCommandEvent& WXUNUSED(event)); 121 | virtual void OnSelect_ConvertBezierToLine(wxCommandEvent& WXUNUSED(event)); 122 | virtual void OnSelect_C1ContinuityBezier(wxCommandEvent& WXUNUSED(event)); 123 | virtual void OnSelect_Move00Here(wxCommandEvent& WXUNUSED(event)); 124 | void OnAlphaSliderChanged(wxScrollEvent &event); 125 | 126 | // to replace _PointSystem() that has been made protected 127 | double GetScale() { return pointsys->scale; } 128 | double GetOriginX() { return pointsys->originx; } 129 | double GetOriginY() { return pointsys->originy; } 130 | 131 | // undo/redo system 132 | virtual void AddUndo( wxString desc ); 133 | virtual bool UndoOrRedo(bool isundo); 134 | virtual bool Undo(); 135 | virtual bool Redo(); 136 | virtual wxString GetTopUndo(); 137 | virtual wxString GetTopRedo(); 138 | virtual void RefreshUndocmds(); 139 | 140 | virtual bool HasBackgroundImage() { return bgimg.bgimg != NULL; } 141 | virtual void RemoveBackgroundImage(); 142 | virtual void ReceiveBackgroundImageFileDropEvent(const wxString& filename); 143 | virtual void SetBackgroundImage(const wxImage& img, wxString fname = _T(""), bool ask4alpha = true); 144 | virtual void PrepareBackgroundBitmap(double alpha); 145 | virtual void AskUserForBackgroundAlpha(); 146 | virtual bool GetBackgroundInfo(unsigned& w, unsigned& h, wxRealPoint& disp, double& scale); 147 | 148 | agg::rgba rgba_shape_normal, rgba_outline, rgba_guideline; 149 | agg::rgba rgba_mainpoint, rgba_controlpoint, rgba_selectpoint; 150 | agg::rgba rgba_origin, rgba_ruler_h, rgba_ruler_v; 151 | 152 | protected: 153 | 154 | typedef PixelFormat::AGGType::color_type color_type; 155 | typedef agg::span_interpolator_linear<> interpolator_type; 156 | typedef agg::span_image_filter_rgb_bilinear_clip span_gen_type; 157 | 158 | // The GUI window 159 | ASSDrawFrame* m_frame; 160 | 161 | // highlight mechanism 162 | DrawCmd* hilite_cmd; 163 | Point* hilite_point; 164 | 165 | // mouse capture 166 | bool capturemouse_left, capturemouse_right; 167 | virtual void CustomOnMouseCaptureLost(wxMouseCaptureLostEvent &event); 168 | virtual void ProcessOnMouseLeftUp(); 169 | virtual void ProcessOnMouseRightUp(); 170 | 171 | // selection mechanism 172 | PointSet selected_points; 173 | 174 | // if it has status bar 175 | bool hasStatusBar; 176 | 177 | // some mouse readings 178 | Point* mousedownAt_point; 179 | Point* pointedAt_point; 180 | Point* dblclicked_point_right; 181 | wxPoint mouse_point; 182 | 183 | // The wxPoint being dragged by left button 184 | wxPoint* dragAnchor_left; 185 | wxPoint* lastDrag_left; 186 | 187 | // The wxPoint being dragged by right button 188 | wxPoint* dragAnchor_right; 189 | wxPoint* lastDrag_right; 190 | 191 | // true if the drawing origin (0, 0) is being dragged 192 | bool dragOrigin; 193 | 194 | // The newest command being initialized thru dragging action 195 | DrawCmd* newcommand; 196 | 197 | // the draw mode 198 | MODE draw_mode; 199 | DRAGMODE drag_mode; 200 | 201 | // holding shift key temporarily switches to drag mode (MODE_ARR) 202 | // so we want to save the mode before the key-down to restore it on key-up 203 | MODE mode_b4_shift; 204 | 205 | // true if preview mode (i.e don't draw anything except the shape itself; 206 | // also draw the shape as closed) 207 | bool preview_mode; 208 | 209 | // background image! 210 | struct 211 | { 212 | agg::rendering_buffer ibuf; 213 | wxImage *bgimg; 214 | wxBitmap *bgbmp; 215 | wxString bgimgfile; 216 | agg::path_storage bg_path; 217 | agg::span_allocator spanalloc; 218 | //span_gen_type spangen; 219 | agg::trans_affine img_mtx, path_mtx; 220 | 221 | wxRealPoint disp, center, new_disp, new_center; 222 | double scale, new_scale, alpha; 223 | wxDialog* alpha_dlg; 224 | wxSlider* alpha_slider; 225 | } bgimg; 226 | 227 | // Undo/redo system (simply stores the ASS commands) 228 | std::list undos; 229 | std::list redos; 230 | UndoRedo _undo; 231 | 232 | // last action and commands (for undo/redo system) 233 | wxString undodesc; 234 | 235 | wxString oldasscmds; 236 | 237 | // was preview_mode 238 | //bool was_preview_mode; 239 | 240 | PointSystem* _PointSystem() { return pointsys; } 241 | 242 | // for Undo/Redo system 243 | virtual void PrepareUndoRedo(UndoRedo& ur, bool prestage, wxString cmds, wxString desc); 244 | 245 | // -------------------- points highlight/selection --------------------------- 246 | 247 | // set command and point to highlight 248 | virtual void SetHighlighted ( DrawCmd* cmd, Point* point ); 249 | 250 | // selects all points within (lx, ty) , (rx, by) returns # of selected points 251 | virtual int SelectPointsWithin( int lx, int rx, int ty, int by, SELECTMODE smode = NEW ); 252 | virtual void ClearPointsSelection(); 253 | virtual SELECTMODE GetSelectMode(wxMouseEvent &event); 254 | 255 | // -------------------- misc --------------------------- 256 | 257 | // non-uniform transformation 258 | virtual bool InitiateDraggingIfTransformMode(); 259 | virtual void UpdateTranformModeRectCenter(); 260 | virtual bool GetThe4thPoint(double ox, double oy, double a1x, double a1y, double a2x, double a2y, double *x, double *y); 261 | enum { NONE, LEFT, RIGHT } backupowner; 262 | agg::path_storage backupcmds; 263 | int rectbound2upd, rectbound2upd2; 264 | wxRealPoint rectbound[4], rectbound2[4], backup[4], rectcenter; 265 | bool isshapetransformable; 266 | 267 | // do the real drawing 268 | virtual void DoDraw( RendererBase& rbase, RendererPrimitives& rprim, RendererSolid& rsolid, agg::trans_affine& mtx ); 269 | 270 | // update background image scale & position 271 | virtual void UpdateBackgroundImgScalePosition(bool firsttime = false); 272 | 273 | // perform extra stuff other than calling ASSDrawEngine::ConnectSubsequentCmds 274 | virtual void ConnectSubsequentCmds (DrawCmd* cmd1, DrawCmd* cmd2); 275 | 276 | // make sure the c1 continuity is followed after performing a drag-point action 277 | virtual void EnforceC1Continuity (DrawCmd* cmd, Point* pnt); 278 | 279 | // after the bounding quadrangle has changed, update the shape to fill up inside it 280 | virtual void UpdateNonUniformTransformation(); 281 | 282 | friend struct UndoRedo; 283 | 284 | DECLARE_EVENT_TABLE() 285 | }; 286 | 287 | class ASSDrawFileDropTarget : public wxFileDropTarget 288 | { 289 | public: 290 | ASSDrawFileDropTarget(ASSDrawCanvas *canvas): wxFileDropTarget() 291 | { 292 | m_canvas = canvas; 293 | } 294 | 295 | virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) 296 | { 297 | m_canvas->ReceiveBackgroundImageFileDropEvent(filenames.Item(0)); 298 | return true; 299 | } 300 | 301 | protected: 302 | ASSDrawCanvas *m_canvas; 303 | 304 | }; 305 | -------------------------------------------------------------------------------- /src/settings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, ai-chan 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * * Neither the name of the ASSDraw3 Team nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Name: settings.cpp 29 | // Purpose: settings property grid 30 | // Author: ai-chan 31 | // Created: 08/26/06 32 | // Copyright: (c) ai-chan 33 | // Licence: 3-clause BSD 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | #include "assdraw.hpp" 37 | #include "settings.hpp" 38 | 39 | DEFINE_EVENT_TYPE(wxEVT_SETTINGS_CHANGED) 40 | 41 | // ---------------------------------------------------------------------------- 42 | // ASSDrawSettingsDialog 43 | // ---------------------------------------------------------------------------- 44 | 45 | ASSDrawSettingsDialog::ASSDrawSettingsDialog(wxWindow *parent, ASSDrawFrame *frame, int id) 46 | : wxPanel(parent, id) 47 | { 48 | m_frame = frame; 49 | propgrid = NULL; 50 | } 51 | 52 | void ASSDrawSettingsDialog::Init() 53 | { 54 | propgrid = new wxPropertyGrid(this, 55 | wxID_ANY, 56 | wxDefaultPosition, 57 | wxDefaultSize, 58 | //wxPG_BOLD_MODIFIED | 59 | //wxPG_SPLITTER_AUTO_CENTER | 60 | //wxPG_AUTO_SORT | 61 | //wxPG_HIDE_MARGIN | wxPG_STATIC_SPLITTER | 62 | wxPG_TOOLTIPS | 63 | //wxPG_NOCATEGORIES | 64 | wxTAB_TRAVERSAL //| 65 | //wxSUNKEN_BORDER 66 | ); 67 | 68 | #define APPENDCOLOURPROP(pgid, label, color) pgid = propgrid->Append(new wxColourProperty(label, wxPG_LABEL, color)); 69 | #define APPENDUINTPROP(pgid, label, uint) \ 70 | pgid = propgrid->Append(new wxUIntProperty(label, wxPG_LABEL, uint) ); \ 71 | propgrid->SetPropertyValidator( pgid, validator ); 72 | #define APPENDBOOLPROP(pgid, label, boolvar) \ 73 | pgid = propgrid->Append(new wxBoolProperty (label, wxPG_LABEL, boolvar ) ); \ 74 | propgrid->SetPropertyAttribute( pgid, wxPG_BOOL_USE_CHECKBOX, (long)1 ); 75 | wxLongPropertyValidator validator(0x0,0xFF); 76 | 77 | propgrid->Append(new wxPropertyCategory(_T("Appearance"),wxPG_LABEL) ); 78 | APPENDCOLOURPROP(colors_canvas_bg_pgid, _T("Canvas"), m_frame->colors.canvas_bg) 79 | APPENDCOLOURPROP(colors_canvas_shape_normal_pgid, _T("Drawing"), m_frame->colors.canvas_shape_normal) 80 | APPENDUINTPROP(alphas_canvas_shape_normal_pgid, _T("Drawing @"), m_frame->alphas.canvas_shape_normal) 81 | APPENDCOLOURPROP(colors_canvas_shape_preview_pgid, _T("Preview"), m_frame->colors.canvas_shape_preview) 82 | APPENDUINTPROP(alphas_canvas_shape_preview_pgid, _T("Preview @"), m_frame->alphas.canvas_shape_preview) 83 | APPENDCOLOURPROP(colors_canvas_shape_outline_pgid, _T("Outline"), m_frame->colors.canvas_shape_outline) 84 | APPENDUINTPROP(alphas_canvas_shape_outline_pgid, _T("Outline @"), m_frame->alphas.canvas_shape_outline) 85 | APPENDCOLOURPROP(colors_canvas_shape_guideline_pgid, _T("Control lines"), m_frame->colors.canvas_shape_guideline) 86 | APPENDUINTPROP(alphas_canvas_shape_guideline_pgid, _T("Control lines @"), m_frame->alphas.canvas_shape_guideline) 87 | APPENDCOLOURPROP(colors_canvas_shape_mainpoint_pgid, _T("Points"), m_frame->colors.canvas_shape_mainpoint) 88 | APPENDUINTPROP(alphas_canvas_shape_mainpoint_pgid, _T("Points @"), m_frame->alphas.canvas_shape_mainpoint) 89 | APPENDCOLOURPROP(colors_canvas_shape_controlpoint_pgid, _T("Control points"), m_frame->colors.canvas_shape_controlpoint) 90 | APPENDUINTPROP(alphas_canvas_shape_controlpoint_pgid, _T("Control points @"), m_frame->alphas.canvas_shape_controlpoint) 91 | APPENDCOLOURPROP(colors_canvas_shape_selectpoint_pgid, _T("Selected points"), m_frame->colors.canvas_shape_selectpoint) 92 | APPENDUINTPROP(alphas_canvas_shape_selectpoint_pgid, _T("Selected points @"), m_frame->alphas.canvas_shape_selectpoint) 93 | APPENDCOLOURPROP(colors_library_libarea_pgid, _T("Library"), m_frame->colors.library_libarea) 94 | APPENDCOLOURPROP(colors_library_shape_pgid, _T("Library shapes"), m_frame->colors.library_shape) 95 | APPENDCOLOURPROP(colors_origin_pgid, _T("Origin"), m_frame->colors.origin) 96 | APPENDUINTPROP(sizes_origincross_pgid, _T("Origin cross size"), m_frame->sizes.origincross) 97 | APPENDCOLOURPROP(colors_ruler_h_pgid, _T("H ruler"), m_frame->colors.ruler_h) 98 | APPENDCOLOURPROP(colors_ruler_v_pgid, _T("V ruler"), m_frame->colors.ruler_v) 99 | 100 | propgrid->Append(new wxPropertyCategory(_T("Behaviors"),wxPG_LABEL) ); 101 | APPENDBOOLPROP(behaviors_capitalizecmds_pgid, _T("Capitalize commands"), m_frame->behaviors.capitalizecmds); 102 | APPENDBOOLPROP(behaviors_autoaskimgopac_pgid, _T("Ask for image opacity"), m_frame->behaviors.autoaskimgopac); 103 | APPENDBOOLPROP(behaviors_parse_spc_pgid, _T("Parse S/P/C"), m_frame->behaviors.parse_spc); 104 | APPENDBOOLPROP(behaviors_nosplashscreen_pgid, _T("No splash screen"), m_frame->behaviors.nosplashscreen); 105 | APPENDBOOLPROP(behaviors_confirmquit_pgid, _T("Confirm quit"), m_frame->behaviors.confirmquit); 106 | 107 | wxFlexGridSizer *sizer = new wxFlexGridSizer(2, 1, 0, 0); 108 | sizer->AddGrowableCol(0); 109 | sizer->AddGrowableRow(0); 110 | sizer->Add(propgrid, 1, wxEXPAND); 111 | 112 | wxBoxSizer *bsizer = new wxBoxSizer(wxHORIZONTAL); 113 | wxButton *abutton = new wxButton(this, wxID_ANY, _T("Apply")); 114 | abutton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ASSDrawSettingsDialog::OnSettingsApplyButtonClicked), NULL, this); 115 | bsizer->Add(abutton, 2, wxEXPAND); 116 | wxButton *rbutton = new wxButton(this, wxID_ANY, _T("Revert")); 117 | rbutton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ASSDrawSettingsDialog::OnSettingsRevertButtonClicked), NULL, this); 118 | bsizer->Add(rbutton, 1, wxEXPAND); 119 | bsizer->Layout(); 120 | 121 | sizer->Add(bsizer, 1, wxEXPAND); 122 | sizer->Layout(); 123 | SetSizer(sizer); 124 | } 125 | 126 | ASSDrawSettingsDialog::~ASSDrawSettingsDialog() 127 | { 128 | if (propgrid) propgrid->Clear(); 129 | } 130 | 131 | void ASSDrawSettingsDialog::OnSettingsApplyButtonClicked(wxCommandEvent &event) 132 | { 133 | 134 | wxButton *button = (wxButton *) event.GetEventObject(); 135 | //wxPropertyGrid *propgrid = (wxPropertyGrid *) button->GetClientData(); 136 | if (propgrid == NULL) return; 137 | 138 | #define PARSECOLOR(color, pgid) \ 139 | { \ 140 | wxVariant variant = propgrid->GetPropertyValue(pgid); \ 141 | color = *wxGetVariantCast(variant,wxColour); \ 142 | } 143 | 144 | #define PARSE(ptr, pgid) propgrid->GetPropertyValue(pgid).Convert(ptr); 145 | 146 | PARSECOLOR(m_frame->colors.canvas_bg, colors_canvas_bg_pgid) 147 | PARSECOLOR(m_frame->colors.canvas_shape_controlpoint, colors_canvas_shape_controlpoint_pgid) 148 | PARSECOLOR(m_frame->colors.canvas_shape_guideline, colors_canvas_shape_guideline_pgid) 149 | PARSECOLOR(m_frame->colors.canvas_shape_mainpoint, colors_canvas_shape_mainpoint_pgid) 150 | PARSECOLOR(m_frame->colors.canvas_shape_normal, colors_canvas_shape_normal_pgid) 151 | PARSECOLOR(m_frame->colors.canvas_shape_outline, colors_canvas_shape_outline_pgid) 152 | PARSECOLOR(m_frame->colors.canvas_shape_preview, colors_canvas_shape_preview_pgid) 153 | PARSECOLOR(m_frame->colors.canvas_shape_selectpoint, colors_canvas_shape_selectpoint_pgid) 154 | PARSECOLOR(m_frame->colors.library_libarea, colors_library_libarea_pgid) 155 | PARSECOLOR(m_frame->colors.library_shape, colors_library_shape_pgid) 156 | PARSECOLOR(m_frame->colors.origin, colors_origin_pgid) 157 | PARSECOLOR(m_frame->colors.ruler_h, colors_ruler_h_pgid) 158 | PARSECOLOR(m_frame->colors.ruler_v, colors_ruler_v_pgid) 159 | 160 | PARSE(&m_frame->alphas.canvas_shape_controlpoint, alphas_canvas_shape_controlpoint_pgid) 161 | PARSE(&m_frame->alphas.canvas_shape_guideline, alphas_canvas_shape_guideline_pgid) 162 | PARSE(&m_frame->alphas.canvas_shape_mainpoint, alphas_canvas_shape_mainpoint_pgid) 163 | PARSE(&m_frame->alphas.canvas_shape_normal, alphas_canvas_shape_normal_pgid) 164 | PARSE(&m_frame->alphas.canvas_shape_outline, alphas_canvas_shape_outline_pgid) 165 | PARSE(&m_frame->alphas.canvas_shape_preview, alphas_canvas_shape_preview_pgid) 166 | PARSE(&m_frame->alphas.canvas_shape_selectpoint, alphas_canvas_shape_selectpoint_pgid) 167 | 168 | PARSE(&m_frame->sizes.origincross, sizes_origincross_pgid) 169 | 170 | PARSE(&m_frame->behaviors.autoaskimgopac, behaviors_autoaskimgopac_pgid) 171 | PARSE(&m_frame->behaviors.capitalizecmds, behaviors_capitalizecmds_pgid) 172 | PARSE(&m_frame->behaviors.parse_spc, behaviors_parse_spc_pgid) 173 | PARSE(&m_frame->behaviors.nosplashscreen, behaviors_nosplashscreen_pgid) 174 | PARSE(&m_frame->behaviors.confirmquit, behaviors_confirmquit_pgid) 175 | 176 | wxCommandEvent evento( wxEVT_SETTINGS_CHANGED, event.GetId() ); 177 | evento.SetEventObject( button ); 178 | m_frame->GetEventHandler()->ProcessEvent( evento ); 179 | 180 | } 181 | 182 | void ASSDrawSettingsDialog::OnSettingsRevertButtonClicked(wxCommandEvent &event) 183 | { 184 | RefreshSettingsDisplay(); 185 | } 186 | 187 | void ASSDrawSettingsDialog::RefreshSettingsDisplay() 188 | { 189 | if (propgrid == NULL) return; 190 | 191 | #define UPDATESETTING(value, pgid) propgrid->SetPropertyValue(pgid, value); 192 | 193 | UPDATESETTING(m_frame->colors.canvas_bg, colors_canvas_bg_pgid) 194 | UPDATESETTING(m_frame->colors.canvas_shape_controlpoint, colors_canvas_shape_controlpoint_pgid) 195 | UPDATESETTING(m_frame->colors.canvas_shape_guideline, colors_canvas_shape_guideline_pgid) 196 | UPDATESETTING(m_frame->colors.canvas_shape_mainpoint, colors_canvas_shape_mainpoint_pgid) 197 | UPDATESETTING(m_frame->colors.canvas_shape_normal, colors_canvas_shape_normal_pgid) 198 | UPDATESETTING(m_frame->colors.canvas_shape_outline, colors_canvas_shape_outline_pgid) 199 | UPDATESETTING(m_frame->colors.canvas_shape_preview, colors_canvas_shape_preview_pgid) 200 | UPDATESETTING(m_frame->colors.canvas_shape_selectpoint, colors_canvas_shape_selectpoint_pgid) 201 | UPDATESETTING(m_frame->colors.library_libarea, colors_library_libarea_pgid) 202 | UPDATESETTING(m_frame->colors.library_shape, colors_library_shape_pgid) 203 | UPDATESETTING(m_frame->colors.origin, colors_origin_pgid) 204 | UPDATESETTING(m_frame->colors.ruler_h, colors_ruler_h_pgid) 205 | UPDATESETTING(m_frame->colors.ruler_v, colors_ruler_v_pgid) 206 | 207 | UPDATESETTING(m_frame->alphas.canvas_shape_controlpoint, alphas_canvas_shape_controlpoint_pgid) 208 | UPDATESETTING(m_frame->alphas.canvas_shape_guideline, alphas_canvas_shape_guideline_pgid) 209 | UPDATESETTING(m_frame->alphas.canvas_shape_mainpoint, alphas_canvas_shape_mainpoint_pgid) 210 | UPDATESETTING(m_frame->alphas.canvas_shape_normal, alphas_canvas_shape_normal_pgid) 211 | UPDATESETTING(m_frame->alphas.canvas_shape_outline, alphas_canvas_shape_outline_pgid) 212 | UPDATESETTING(m_frame->alphas.canvas_shape_preview, alphas_canvas_shape_preview_pgid) 213 | UPDATESETTING(m_frame->alphas.canvas_shape_selectpoint, alphas_canvas_shape_selectpoint_pgid) 214 | 215 | UPDATESETTING(m_frame->sizes.origincross, sizes_origincross_pgid) 216 | 217 | UPDATESETTING(m_frame->behaviors.capitalizecmds, behaviors_capitalizecmds_pgid) 218 | UPDATESETTING(m_frame->behaviors.autoaskimgopac, behaviors_autoaskimgopac_pgid) 219 | UPDATESETTING(m_frame->behaviors.parse_spc, behaviors_parse_spc_pgid) 220 | UPDATESETTING(m_frame->behaviors.nosplashscreen, behaviors_nosplashscreen_pgid) 221 | UPDATESETTING(m_frame->behaviors.confirmquit, behaviors_confirmquit_pgid) 222 | 223 | } 224 | --------------------------------------------------------------------------------