diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index be40bcd40..0d6f2f3b1 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -467,7 +467,7 @@ static wxString FindHelpFile(const char* topic) wxString str; for (int i = 0; i < 2; i++) { - str = GetHelpDir(); + str = GetHelpDir(); str += i == 0 ? strTopic.Left(2) : strApp.Left(2); str += "help.pdf"; if (::wxFileExists(str)) @@ -542,7 +542,18 @@ int OsWin32_Help(WXHWND handle, const char* hlp, unsigned int cmd, const char* t } } else if (str.EndsWith(".html")) - ::ShellExecute((HWND)handle, "open", str, NULL, NULL, SW_SHOWDEFAULT); + { + wxFileName fn = str; + fn.MakeAbsolute(); + str = fn.GetFullPath(); + unsigned long err = (unsigned long)::ShellExecute((HWND)handle, "open", str, NULL, NULL, SW_SHOWNORMAL); + if (err <= 32) + { + wxString msg; + msg << "Can't open '" << str << "': error " << err; + wxMessageBox(msg, "Campo", wxICON_WARNING | wxOK); + } + } return true; } diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 631a4112c..7f43a0439 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -788,6 +788,14 @@ void xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey) } } +void xvt_dwin_draw_checkmark(WINDOW win, const RCT* rctp) +{ + CAST_DC(win, dc); + const wxRect rct = RCT2Rect(rctp); + dc.DrawCheckMark(rct); +} + + void xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR col2, const PNT* center) { if (win != NULL_WIN && r != NULL) @@ -957,7 +965,7 @@ void xvt_dwin_draw_polyline(WINDOW win, const PNT *lpnts, int npnts) } } -void xvt_dwin_draw_rect(WINDOW win, RCT *rctp) +void xvt_dwin_draw_rect(WINDOW win, const RCT* rctp) { CAST_DC(win, dc); const wxRect rct = RCT2Rect(rctp); diff --git a/xvaga/xvt.h b/xvaga/xvt.h index 62e6267f4..423ca1838 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -111,6 +111,7 @@ XVTDLL int xvt_dongle_sa_test(const char* module); XVTDLL void xvt_dwin_clear(WINDOW win, COLOR col); XVTDLL void xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey); +XVTDLL void xvt_dwin_draw_checkmark(WINDOW win, const RCT* rctp); XVTDLL void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid); XVTDLL void xvt_dwin_draw_icon_rect(WINDOW win, RCT* rct, int rid); XVTDLL void xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR col2, const PNT* center); // Added by AGA @@ -122,7 +123,7 @@ XVTDLL void xvt_dwin_draw_oval(WINDOW Win, const RCT* r); XVTDLL void xvt_dwin_draw_pie(WINDOW win, const RCT *rctp, int start_x, int start_y, int stop_x, int stop_y); XVTDLL void xvt_dwin_draw_polygon(WINDOW win, const PNT *lpnts, int npnts); XVTDLL void xvt_dwin_draw_polyline(WINDOW win, const PNT *lpnts, int npnts); -XVTDLL void xvt_dwin_draw_rect(WINDOW win, RCT *rctp); +XVTDLL void xvt_dwin_draw_rect(WINDOW win, const RCT *rctp); XVTDLL void xvt_dwin_draw_roundrect(WINDOW win, const RCT *rctp, int oval_width, int oval_height); XVTDLL void xvt_dwin_draw_dotted_rect(WINDOW win, RCT *rctp); // Added by Guy XVTDLL void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size); // Added by Guy diff --git a/xvaga/xvtctl.cpp b/xvaga/xvtctl.cpp index bb85855c1..0804cf7e6 100755 --- a/xvaga/xvtctl.cpp +++ b/xvaga/xvtctl.cpp @@ -109,6 +109,7 @@ class TwxNoteBook : public wxAuiNotebook protected: virtual bool SetBackgroundColour(const wxColour& col); + virtual bool SetForegroundColour(const wxColour& col); void OnChar(wxKeyEvent& evt); void OnPageChanging(wxAuiNotebookEvent& e); @@ -236,6 +237,7 @@ protected: virtual void OnKillFocus(wxFocusEvent& e); virtual void OnSelected(wxCommandEvent& e); virtual void OnKeyDown(wxKeyEvent& e); + virtual void OnLeftDown(wxMouseEvent& e); public: int Add(const wxString str); @@ -650,11 +652,29 @@ XVTDLL BOOLEAN xvt_pane_set_size_range(WINDOW win, int min_size, int best_size, class TwxAuiDefaultTabArt : public wxAuiDefaultTabArt { + wxColour m_fore_colour; + +protected: + virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane, + const wxRect& in_rect, int close_button_state, + wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent); + public: void SetBackgroundColour(const wxColor& colour) { m_base_colour = colour; } + void SetForegroundColour(const wxColor& colour) { m_fore_colour = colour; } virtual wxAuiTabArt* Clone(); }; +void TwxAuiDefaultTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane, + const wxRect& in_rect, int close_button_state, + wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent) +{ + dc.SetTextForeground(m_fore_colour); + wxAuiDefaultTabArt::DrawTab(dc, wnd, pane, in_rect, close_button_state, + out_tab_rect, out_button_rect, x_extent); +} + + wxAuiTabArt* TwxAuiDefaultTabArt::Clone() { TwxAuiDefaultTabArt* art = new TwxAuiDefaultTabArt(); @@ -666,6 +686,7 @@ wxAuiTabArt* TwxAuiDefaultTabArt::Clone() // My own addition art->m_base_colour = m_base_colour; + art->m_fore_colour = m_fore_colour; return art; } @@ -695,6 +716,19 @@ bool TwxNoteBook::SetBackgroundColour(const wxColour& col) return ok; } +bool TwxNoteBook::SetForegroundColour(const wxColour& col) +{ + const bool ok = wxAuiNotebook::SetForegroundColour(col); + if (ok) // Se cambio il colore del testo del tab control devo notificarlo all'art provider + { + TwxAuiDefaultTabArt* pArtist = (TwxAuiDefaultTabArt*)GetArtProvider(); + if (pArtist != NULL) + pArtist->SetForegroundColour(col); + } + return ok; +} + + void TwxNoteBook::OnChar(wxKeyEvent& evt) { // Ridirige i tasti che non sono certamente di navigazione alla finestra nonna @@ -1833,6 +1867,7 @@ BEGIN_EVENT_TABLE(TwxPopUp, wxVListBox) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxPopUp::OnSelected) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxPopUp::OnSelected) EVT_MOTION(TwxPopUp::OnMouseMove) + EVT_LEFT_DOWN(TwxPopUp::OnLeftDown) EVT_KILL_FOCUS(TwxPopUp::OnKillFocus) EVT_KEY_DOWN(TwxPopUp::OnKeyDown) END_EVENT_TABLE() @@ -1887,6 +1922,16 @@ void TwxPopUp::OnMouseMove(wxMouseEvent& evt) } } +void TwxPopUp::OnLeftDown(wxMouseEvent& evt) +{ + const wxRect rect = GetClientRect(); + const wxPoint pt = evt.GetPosition(); + if (rect.Contains(evt.GetPosition())) + wxVListBox::OnLeftDown(evt); + else + Hide(); +} + void TwxPopUp::OnKillFocus(wxFocusEvent& WXUNUSED(e)) { Hide(); @@ -2040,15 +2085,20 @@ MENU_TAG xvt_list_popup(WINDOW parent_win, const RCT* ownrct, const MENU_ITEM* m lb->SetSelection(sel); lb->Show(); lb->SetFocus(); + + lb->CaptureMouse(); + wxApp* a = wxTheApp; // Memorizzo il risultato di wxGetInstance while (lb->IsShown()) { - wxApp* a = wxTheApp; // Memorizzo il risultato di wxGetInstance while (a->Pending()) a->Dispatch(); lb->Raise(); + a->ProcessIdle(); wxMilliSleep(50); } sel = lb->GetSelection(); + lb->ReleaseMouse(); + delete lb; } } @@ -2076,6 +2126,8 @@ protected: void OnTool(wxCommandEvent& evt); void OnEraseBackground(wxEraseEvent& evt); virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); + TwxToolBar() : TwxToolBarBase(NULL, wxID_ANY) { wxASSERT(false); } public: @@ -2120,32 +2172,19 @@ void TwxToolBar::OnEraseBackground(wxEraseEvent& evt) const wxColour b1 = ModulateColour(b0, -10); const wxColour b2 = ModulateColour(b0, +70); wxCoord cw, ch; dc.GetSize(&cw, &ch); - switch (xvt_sys_get_oem_int("OEM", -1)) - { - case 0: - { - // Nuovo modo: effetto acqua in stile TwxOutlookBar - const wxColour b3 = ModulateColour(b1, +20); - const int delta = 2*ch/5; - wxRect r1(0,0,cw,ch), r2(0,0,cw,ch); - r1.height = delta; - r2.y += delta; r2.height -= delta; - dc.GradientFillLinear(r1, b3, b3, wxDOWN); - dc.GradientFillLinear(r2, b1, b2, wxDOWN); - } - break; - case 1: - // Vecchio modo: gradiente classico - dc.GradientFillLinear(wxRect(0,0,cw,ch),b1,b2,wxSOUTH); - break; - default: - { - wxBrush brush(b0); - dc.SetBackground(brush); - dc.Clear(); - } - break; - } +#if wxCHECK_VERSION(2,8,12) + // Nuovo modo: effetto acqua in stile TwxOutlookBar + const wxColour b3 = ModulateColour(b1, +20); + const int delta = 2*ch/5; + wxRect r1(0,0,cw,ch), r2(0,0,cw,ch); + r1.height = delta; + r2.y += delta; r2.height -= delta; + dc.GradientFillLinear(r1, b3, b3, wxDOWN); + dc.GradientFillLinear(r2, b1, b2, wxDOWN); +#else + // Vecchio modo: gradiente classico + dc.GradientFillLinear(wxRect(0,0,cw,ch),b1,b2,wxSOUTH); +#endif } } @@ -2161,6 +2200,19 @@ bool TwxToolBar::SetBackgroundColour(const wxColour& colour) return ok; } +bool TwxToolBar::SetForegroundColour(const wxColour& colour) +{ + const bool ok = TwxToolBarBase::SetForegroundColour(colour); + if (ok) // Se cambio lo sfondo della toolbar devo aggiornare anche quello del gripper + { + wxAuiDockArt* pArtist = FindArtist(this); + if (pArtist != NULL) + pArtist->SetColor(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR, colour); + } + return ok; +} + + void TwxToolBar::SetBackgroundTexture(XVT_IMAGE xvt_img) { if (xvt_img != NULL) diff --git a/xvaga/xvtdm.cpp b/xvaga/xvtdm.cpp index 8ee2bfda9..1f9dba708 100755 --- a/xvaga/xvtdm.cpp +++ b/xvaga/xvtdm.cpp @@ -488,7 +488,7 @@ int xvt_dm_speech_enabled(void) void xvt_dm_post_about_box() { const char* ver = (const char*)xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_STRING); - if (ver == NULL || !*ver) ver = "2010 10.0/900"; + if (ver == NULL || !*ver) ver = "2012 11.0/200"; wxString msg; msg << "Versione " << ver; xvt_dm_post_message(msg); } @@ -743,14 +743,12 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD* WXUNUSED( void xvt_dm_post_message(const char *fmt) { - //_MessageBox(fmt, wxOK | wxICON_INFORMATION); - _PopUpBox(fmt, wxICON_INFORMATION, 0); + _MessageBox(fmt, wxOK | wxICON_INFORMATION); } void xvt_dm_post_note(const char *fmt) { - // _MessageBox(fmt, wxOK | wxICON_EXCLAMATION); - _PopUpBox(fmt, wxICON_EXCLAMATION, 0); + _PopUpBox(fmt, wxICON_INFORMATION); } char* xvt_dm_post_string_prompt(const char* message, char* response, int response_len)