Mercurial > mercurial > hgweb_qlipbrd.cgi
changeset 3:fd4361d2cbbd default tip
add remember function.
author | pyon@macmini |
---|---|
date | Thu, 24 Sep 2015 07:45:26 +0900 |
parents | 50d9f4e2a540 |
children | |
files | include/adddialog.h include/qdata.h src/adddialog.cpp src/mainframe.cpp |
diffstat | 4 files changed, 60 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/include/adddialog.h Mon Sep 14 19:25:51 2015 +0900 +++ b/include/adddialog.h Thu Sep 24 07:45:26 2015 +0900 @@ -1,5 +1,5 @@ // Filename: adddialog.h -// Last Change: 2015-09-12 Sat 11:49:15. +// Last Change: 2015-09-24 Thu 06:08:43. // #ifndef __ADDDLG_H__ @@ -26,6 +26,7 @@ bool m_owrite; int m_maxat; int m_maxlt; + bool m_remember; wxString m_desc; protected: @@ -37,21 +38,31 @@ }; wxStaticText* m_staticText; + wxStaticText* m_staticTextText; wxTextCtrl* m_textCtrlText; wxStaticText* m_staticTextText2; + wxStaticText* m_staticTextOverwrite; wxCheckBox* m_checkBoxOverwrite; wxStaticText* m_staticTextOverwrite2; + wxStaticText* m_staticTextMaxLive; wxSpinCtrl* m_spinCtrlMaxLive; wxStaticText* m_staticTextMaxLive2; + wxStaticText* m_staticTextMaxActive; wxSpinCtrl* m_spinCtrlMaxActive; wxStaticText* m_staticTextMaxActive2; + + wxStaticText* m_staticTextRemember; + wxCheckBox* m_checkBoxRemember; + wxStaticText* m_staticTextRemember2; + wxStaticText* m_staticTextDesc; wxTextCtrl* m_textCtrlDesc; wxStaticText* m_staticTextDesc2; + wxButton* m_buttonAdd; wxButton* m_buttonCancel; @@ -63,11 +74,12 @@ void Init(); void SetValidators(); - wxString GetText() { return m_text; }; - bool GetOverwrite() { return m_owrite; }; - int GetMaxActiveTime() { return m_maxat; }; - int GetMaxLiveTime() { return m_maxlt; }; - wxString GetDesc() { return m_desc; }; + wxString GetText() { return m_text; }; + bool GetOverwrite() { return m_owrite; }; + int GetMaxActiveTime() { return m_maxat; }; + int GetMaxLiveTime() { return m_maxlt; }; + wxString GetDesc() { return m_desc; }; + bool GetRemember() { return m_remember; }; }; #endif //__ADDDLG_H__
--- a/include/qdata.h Mon Sep 14 19:25:51 2015 +0900 +++ b/include/qdata.h Thu Sep 24 07:45:26 2015 +0900 @@ -1,5 +1,5 @@ // Filename: qdata.h -// Last Change: 2015-09-13 Sun 09:28:00. +// Last Change: 2015-09-24 Thu 06:09:33. // #ifndef __QDATA_H__ #define __QDATA_H__ @@ -13,6 +13,7 @@ int max_live_time; int active_time; int live_time; + bool remember; wxString desc; bool IsArrived() {
--- a/src/adddialog.cpp Mon Sep 14 19:25:51 2015 +0900 +++ b/src/adddialog.cpp Thu Sep 24 07:45:26 2015 +0900 @@ -1,5 +1,5 @@ // Filename: adddialog.cpp -// Last Change: 2015-09-13 Sun 14:34:28. +// Last Change: 2015-09-23 Wed 19:59:41. // #include <wx/valgen.h> #include <wx/valtext.h> @@ -16,10 +16,12 @@ m_staticText = new wxStaticText( this, wxID_ANY, wxT("Specify Empty text to Use user input(Ctrl-c).\nDescription is option."), wxDefaultPosition, wxDefaultSize, 0 ); bSizerTop->Add( m_staticText, 0, wxALL|wxEXPAND, 5 ); + // wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 0, 3, 0, 0 ); fgSizer->SetFlexibleDirection( wxBOTH ); fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + // Text m_staticTextText = new wxStaticText( this, wxID_ANY, wxT("Text"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); @@ -29,6 +31,7 @@ m_staticTextText2 = new wxStaticText( this, wxID_ANY, wxT("Strings to paste"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextText2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + // Overwrite m_staticTextOverwrite = new wxStaticText( this, wxID_ANY, wxT("Overwrite"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextOverwrite, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); @@ -38,6 +41,7 @@ m_staticTextOverwrite2 = new wxStaticText( this, wxID_ANY, wxT("Check if allow change by user"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextOverwrite2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + // Max Live Time m_staticTextMaxLive = new wxStaticText( this, wxID_ANY, wxT("Max LT"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextMaxLive, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); @@ -47,6 +51,7 @@ m_staticTextMaxLive2 = new wxStaticText( this, wxID_ANY, wxT("Maximum live time"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextMaxLive2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + // Max Active Time m_staticTextMaxActive = new wxStaticText( this, wxID_ANY, wxT("Max AT"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextMaxActive, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); @@ -56,6 +61,17 @@ m_staticTextMaxActive2 = new wxStaticText( this, wxID_ANY, wxT("Maximum active time"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextMaxActive2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + // Remember + m_staticTextRemember = new wxStaticText( this, wxID_ANY, wxT("Remember"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer->Add( m_staticTextRemember, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_checkBoxRemember = new wxCheckBox( this, ID_CKOW, wxT("reserve text"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer->Add( m_checkBoxRemember, 0, wxALL, 5 ); + + m_staticTextRemember2 = new wxStaticText( this, wxID_ANY, wxT("Check if add text to history"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer->Add( m_staticTextRemember2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + // Description m_staticTextDesc = new wxStaticText( this, wxID_ANY, wxT("Desc"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_staticTextDesc, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); @@ -67,6 +83,7 @@ bSizerTop->Add( fgSizer, 1, wxEXPAND, 5 ); + // Buttons wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); m_buttonAdd = new wxButton( this, wxID_OK, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -121,6 +138,7 @@ m_owrite = false; m_maxat = 5; m_maxlt = 20; + m_remember = false; m_desc = wxEmptyString; m_spinCtrlMaxLive->Enable( false ); } @@ -131,6 +149,7 @@ m_checkBoxOverwrite->SetValidator( wxGenericValidator( &m_owrite ) ); m_spinCtrlMaxLive->SetValidator( wxGenericValidator( &m_maxlt ) ); m_spinCtrlMaxActive->SetValidator( wxGenericValidator( &m_maxat ) ); + m_checkBoxRemember->SetValidator( wxGenericValidator( &m_remember ) ); m_textCtrlDesc->SetValidator( wxTextValidator( wxFILTER_NONE, &m_desc ) ); }
--- a/src/mainframe.cpp Mon Sep 14 19:25:51 2015 +0900 +++ b/src/mainframe.cpp Thu Sep 24 07:45:26 2015 +0900 @@ -1,5 +1,5 @@ // Filename: mainframe.cpp -// Last Change: 2015-09-13 Sun 14:43:27. +// Last Change: 2015-09-24 Thu 07:41:29. // #include <wx/filedlg.h> #include <wx/textfile.h> @@ -21,8 +21,9 @@ #define COL_OW 2 #define COL_MLT 3 #define COL_MAL 4 -#define COL_DESC 5 -#define COL_ID 6 +#define COL_REM 5 +#define COL_DESC 6 +#define COL_ID 7 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ), @@ -91,13 +92,14 @@ m_lisViewCycle = new wxListView( this, ID_LISTVIEW, wxDefaultPosition, wxSize( -1, 100 ), wxLC_REPORT|wxLC_SINGLE_SEL ); wxListItem itemCol; - itemCol.SetText( wxT("No") ); m_lisViewCycle->InsertColumn( COL_NO, itemCol ); m_lisViewCycle->SetColumnWidth( COL_NO, 20 ); - itemCol.SetText( wxT("text") ); m_lisViewCycle->InsertColumn( COL_TEXT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_TEXT, 80 ); - itemCol.SetText( wxT("o/w") ); m_lisViewCycle->InsertColumn( COL_OW, itemCol ); m_lisViewCycle->SetColumnWidth( COL_OW, 40 ); - itemCol.SetText( wxT("live") ); m_lisViewCycle->InsertColumn( COL_MLT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MLT, 50 ); - itemCol.SetText( wxT("active") ); m_lisViewCycle->InsertColumn( COL_MAL, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MAL, 50 ); - itemCol.SetText( wxT("desc") ); m_lisViewCycle->InsertColumn( COL_DESC, itemCol ); m_lisViewCycle->SetColumnWidth( COL_DESC, 80 ); - itemCol.SetText( wxT("id") ); m_lisViewCycle->InsertColumn( COL_ID, itemCol ); m_lisViewCycle->SetColumnWidth( COL_ID, 30 ); + itemCol.SetText( wxT("No") ); m_lisViewCycle->InsertColumn( COL_NO, itemCol ); m_lisViewCycle->SetColumnWidth( COL_NO, 20 ); + itemCol.SetText( wxT("text") ); m_lisViewCycle->InsertColumn( COL_TEXT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_TEXT, 80 ); + itemCol.SetText( wxT("o/w") ); m_lisViewCycle->InsertColumn( COL_OW, itemCol ); m_lisViewCycle->SetColumnWidth( COL_OW, 40 ); + itemCol.SetText( wxT("live") ); m_lisViewCycle->InsertColumn( COL_MLT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MLT, 50 ); + itemCol.SetText( wxT("act.") ); m_lisViewCycle->InsertColumn( COL_MAL, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MAL, 50 ); + itemCol.SetText( wxT("rem.") ); m_lisViewCycle->InsertColumn( COL_REM, itemCol ); m_lisViewCycle->SetColumnWidth( COL_REM, 40 ); + itemCol.SetText( wxT("desc") ); m_lisViewCycle->InsertColumn( COL_DESC, itemCol ); m_lisViewCycle->SetColumnWidth( COL_DESC, 80 ); + itemCol.SetText( wxT("id") ); m_lisViewCycle->InsertColumn( COL_ID, itemCol ); m_lisViewCycle->SetColumnWidth( COL_ID, 30 ); //m_lisViewCycle->EnableAlternateRowColours( true ); bSizerList->Add( m_lisViewCycle, 1, wxALL|wxEXPAND, 5 ); @@ -325,6 +327,7 @@ q->overwrite = add_dlg.GetOverwrite(); q->max_active_time = add_dlg.GetMaxActiveTime(); q->max_live_time = q->overwrite ? add_dlg.GetMaxLiveTime() : 0; + q->remember = add_dlg.GetRemember(); q->desc = add_dlg.GetDesc(); q->active_time = 0; q->live_time = 0; @@ -553,6 +556,13 @@ void MainFrame::UpdateHistory( wxString s ) { if ( s.IsEmpty() ) return; + + QlipDataHash::iterator it; + for ( it = QH.begin(); it != QH.end(); it++ ) { + QlipData* q = it->second; + if ( s.IsSameAs( q->text ) ) return; + } + int row = m_listBoxHist->FindString( s, true ); if ( row != wxNOT_FOUND ) m_listBoxHist->Delete( row );