diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 9d00e8e6d..0ba861b1e 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -524,6 +524,7 @@ void xvt_app_create(int argc, char **argv, unsigned long WXUNUSED(flags), } Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante..."); Menus[0]->Append(M_FILE_PRINT, "&Stampa"); + Menus[0]->Append(M_FILE_PREVIEW, "&Anteprima"); Menus[0]->AppendSeparator(); Menus[0]->Append(M_FILE_QUIT, "&Fine"); Title[1] = "&Modifica"; @@ -577,6 +578,8 @@ void xvt_app_destroy(void) xvt_dm_enable_speech(0x00); #endif + xvt_sign_stop(); + if (_locale != NULL) { delete _locale; @@ -3959,9 +3962,9 @@ int xvt_sys_get_os_version() int xvt_sys_get_version(char* os_version, char* ptk_version, int maxsize) { - if (os_version) + if (os_version && maxsize >= 8) wxStrncpy(os_version, wxGetOsDescription(), maxsize); - if (ptk_version) + if (ptk_version && maxsize >= 8) wxStrncpy(ptk_version, wxVERSION_STRING, maxsize); return xvt_sys_get_os_version(); } diff --git a/xvaga/xvt_menu.h b/xvaga/xvt_menu.h index 8b7c453e4..e5aa0063c 100755 --- a/xvaga/xvt_menu.h +++ b/xvaga/xvt_menu.h @@ -5,7 +5,7 @@ * Agreement with XVT Software. * * $RCSfile: xvt_menu.h,v $ - * $Revision: 1.1 $ + * $Revision: 1.2 $ * * Purpose: XVT menu subsystem definitions. * @@ -17,16 +17,17 @@ #define MAX_MENU_TAG 31999 /* max allowable application menu tag */ #define M_FILE 32000 -#define M_FILE_NEW (M_FILE+1) +#define M_FILE_NEW (M_FILE+1) #define M_FILE_OPEN (M_FILE+2) #define M_FILE_CLOSE (M_FILE+3) #define M_FILE_SAVE (M_FILE+4) -#define M_FILE_SAVE_AS (M_FILE+5) +#define M_FILE_SAVE_AS (M_FILE+5) #define M_FILE_REVERT (M_FILE+6) -#define M_FILE_PG_SETUP (M_FILE+7) +#define M_FILE_PG_SETUP (M_FILE+7) #define M_FILE_PRINT (M_FILE+8) #define M_FILE_QUIT (M_FILE+9) #define M_FILE_ABOUT (M_FILE+10) +#define M_FILE_PREVIEW (M_FILE+11) #define M_EDIT 32025 #define M_EDIT_UNDO (M_EDIT+1) diff --git a/xvaga/xvtctl.cpp b/xvaga/xvtctl.cpp index 42710a4b5..84fce145a 100755 --- a/xvaga/xvtctl.cpp +++ b/xvaga/xvtctl.cpp @@ -137,7 +137,7 @@ class TwxTreeCtrl : public wxTreeCtrl { WX_DECLARE_VOIDPTR_HASH_MAP(int, XVT_IMAGE_Map); XVT_IMAGE_Map m_img; - + wxColour m_clrSelFore, m_clrSelBack; int m_nFrozen; private: @@ -152,9 +152,13 @@ protected: void OnActivated(wxTreeEvent& e); // Calls OnClick(e, true) void OnRightDown(wxMouseEvent& e); + virtual wxColour GetItemTextColour(const wxTreeItemId& id) const; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& id) const; + public: void SetNodeImages(const wxTreeItemId& id, XVT_IMAGE item_image, XVT_IMAGE collapsed_image, XVT_IMAGE expanded_image); + void SetColors(const XVT_COLOR_COMPONENT* colors); void Suspend(); void Resume(); TwxTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size); @@ -222,6 +226,7 @@ class TwxPropertyGrid : public wxPropertyGrid protected: void OnPropertyChanged(wxPropertyGridEvent& evt); public: + void SetColors(const XVT_COLOR_COMPONENT* colors); TwxPropertyGrid(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style); }; @@ -380,54 +385,45 @@ void xvt_ctl_set_colors(WINDOW win, const XVT_COLOR_COMPONENT* colors, XVT_COLOR { if (action == XVT_COLOR_ACTION_SET) { - wxPropertyGrid* pg = wxDynamicCast(w, wxPropertyGrid); + TwxTreeCtrl* tc = wxDynamicCast(w, TwxTreeCtrl); + if (tc != NULL) + { + tc->SetColors(colors); + return; + } + TwxPropertyGrid* pg = wxDynamicCast(w, TwxPropertyGrid); if (pg != NULL) { - for (int i = 0; colors[i].type; i++) - { - CAST_COLOR(colors[i].color, rgb); - switch(colors[i].type) - { - case XVT_COLOR_BACKGROUND: pg->SetCellBackgroundColour(rgb); break; - case XVT_COLOR_FOREGROUND: pg->SetCellTextColour(rgb); pg->SetCaptionForegroundColour(rgb); break; - case XVT_COLOR_HIGHLIGHT : pg->SetSelectionBackground(rgb); break; - case XVT_COLOR_SELECT : pg->SetSelectionForeground(rgb); break; - case XVT_COLOR_BLEND : pg->SetCaptionBackgroundColour(rgb); pg->SetMarginColour(rgb); break; - case XVT_COLOR_TROUGH : pg->SetEmptySpaceColour(rgb); break; - default : break; - } - } + pg->SetColors(colors); + return; } - else + for (int i = 0; colors[i].type; i++) { - for (int i = 0; colors[i].type; i++) + CAST_COLOR(colors[i].color, rgb); + switch(colors[i].type) { - CAST_COLOR(colors[i].color, rgb); - switch(colors[i].type) + case XVT_COLOR_BACKGROUND: w->SetOwnBackgroundColour(rgb); break; + case XVT_COLOR_FOREGROUND: w->SetOwnForegroundColour(rgb); break; + case XVT_COLOR_HIGHLIGHT: { - case XVT_COLOR_BACKGROUND: w->SetOwnBackgroundColour(rgb); break; - case XVT_COLOR_FOREGROUND: w->SetOwnForegroundColour(rgb); break; - case XVT_COLOR_HIGHLIGHT: - { - TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp); - if (tpu != NULL) - tpu->SetSelectForeColor(rgb); - } - break; - case XVT_COLOR_SELECT: - { - TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp); - if (tpu != NULL) - tpu->SetSelectBackColor(rgb); - } - break; - case XVT_COLOR_BLEND: - if (!w->IsKindOf(CLASSINFO(wxButton))) - w->SetOwnBackgroundColour(rgb); - break; - default: - break; + TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp); + if (tpu != NULL) + tpu->SetSelectForeColor(rgb); } + break; + case XVT_COLOR_SELECT: + { + TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp); + if (tpu != NULL) + tpu->SetSelectBackColor(rgb); + } + break; + case XVT_COLOR_BLEND: + if (!w->IsKindOf(CLASSINFO(wxButton))) + w->SetOwnBackgroundColour(rgb); + break; + default: + break; } } } @@ -973,11 +969,37 @@ void TwxTreeCtrl::OnClick(wxTreeEvent& evt, bool bDouble) } } +wxColour TwxTreeCtrl::GetItemTextColour(const wxTreeItemId& id) const +{ + if (IsSelected(id)) + return m_clrSelFore; + return wxTreeCtrl::GetItemTextColour(id); +} + +wxColour TwxTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& id) const +{ + if (IsSelected(id)) + return m_clrSelBack; + return wxTreeCtrl::GetItemBackgroundColour(id); +} + void TwxTreeCtrl::OnSelected(wxTreeEvent& evt) -{ OnClick(evt, false); } +{ + OnClick(evt, false); +} void TwxTreeCtrl::OnActivated(wxTreeEvent& evt) -{ OnClick(evt, true); } +{ + const wxTreeItemId id = evt.GetItem(); + if (ItemHasChildren(id)) + { + if (IsExpanded(id)) + Collapse(id); + else + Expand(id); + } + OnClick(evt, true); +} void TwxTreeCtrl::OnRightDown(wxMouseEvent& evt) { @@ -1083,6 +1105,22 @@ void TwxTreeCtrl::Resume() m_nFrozen--; } +void TwxTreeCtrl::SetColors(const XVT_COLOR_COMPONENT* colors) +{ + for (int i = 0; colors[i].type; i++) + { + CAST_COLOR(colors[i].color, rgb); + switch(colors[i].type) + { + case XVT_COLOR_BACKGROUND: SetOwnBackgroundColour(rgb); break; + case XVT_COLOR_FOREGROUND: SetOwnForegroundColour(rgb); break; + case XVT_COLOR_HIGHLIGHT : m_clrSelBack = rgb; break; + case XVT_COLOR_SELECT : m_clrSelFore = rgb; break; + default : break; + } + } +} + TwxTreeCtrl::TwxTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size) : wxTreeCtrl(parent, id, pos, size, wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT), @@ -2125,6 +2163,25 @@ BEGIN_EVENT_TABLE(TwxPropertyGrid, wxPropertyGrid) EVT_PG_CHANGED(wxID_ANY, TwxPropertyGrid::OnPropertyChanged) END_EVENT_TABLE(); +void TwxPropertyGrid::SetColors(const XVT_COLOR_COMPONENT* colors) +{ + for (int i = 0; colors[i].type; i++) + { + CAST_COLOR(colors[i].color, rgb); + switch(colors[i].type) + { + case XVT_COLOR_BACKGROUND: SetCellBackgroundColour(rgb); break; + case XVT_COLOR_FOREGROUND: SetCellTextColour(rgb); SetCaptionForegroundColour(rgb); break; + case XVT_COLOR_HIGHLIGHT : SetSelectionBackground(rgb); break; + case XVT_COLOR_SELECT : SetSelectionForeground(rgb); break; + case XVT_COLOR_BLEND : SetCaptionBackgroundColour(rgb); SetMarginColour(rgb); break; + case XVT_COLOR_TROUGH : SetEmptySpaceColour(rgb); break; + default : break; + } + } +} + + void TwxPropertyGrid::OnPropertyChanged(wxPropertyGridEvent& evt) { TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow); diff --git a/xvaga/xvtpdf.cpp b/xvaga/xvtpdf.cpp index a85cd3acb..38888c025 100755 --- a/xvaga/xvtpdf.cpp +++ b/xvaga/xvtpdf.cpp @@ -68,6 +68,10 @@ bool TwxPDFDC::StartDoc( const wxString& message ) GetFontsFolder(lpszFontPath, _MAX_PATH); strFontPath.UngetWriteBuf(); m_PDFlib->PDF_set_parameter(m_p, "SearchPath", strFontPath); + + const wxString strUser = wxGetUserId(); + m_PDFlib->PDF_set_info(m_p, "Author", strUser); + m_PDFlib->PDF_set_info(m_p, "Creator", "Campo"); } PDF_CATCH_DL(m_PDFlib, m_p) { diff --git a/xvaga/xvtpdf.h b/xvaga/xvtpdf.h index cf581cabf..14a584529 100755 --- a/xvaga/xvtpdf.h +++ b/xvaga/xvtpdf.h @@ -12,7 +12,7 @@ struct PDF_c {}; class TwxPDFDC : public wxDC { - enum { PDF_IMG_CACHE_SIZE = 4 }; + enum { PDF_IMG_CACHE_SIZE = 13 }; protected: TwxPDFDC(); // Dummy constructor for dynamic construction