📄 userdefinedialog.h
字号:
{
case IDC_COMMENT_FONT_COMBO :
isFontSize = false;
return STYLE_COMMENT_INDEX;
case IDC_COMMENT_FONTSIZE_COMBO :
isFontSize = true;
return STYLE_COMMENT_INDEX;
case IDC_COMMENTLINE_FONT_COMBO :
isFontSize = false;
return STYLE_COMMENTLINE_INDEX;
case IDC_COMMENTLINE_FONTSIZE_COMBO :
isFontSize = true;
return STYLE_COMMENTLINE_INDEX;
case IDC_NUMBER_FONT_COMBO :
isFontSize = false;
return STYLE_NUMBER_INDEX;
case IDC_NUMBER_FONTSIZE_COMBO :
isFontSize = true;
return STYLE_NUMBER_INDEX;
default :
return -1;
}
};
int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, bool & isBold) const {
switch (ctrlID)
{
case IDC_COMMENT_BOLD_CHECK :
isBold = true;
return STYLE_COMMENT_INDEX;
case IDC_COMMENT_ITALIC_CHECK :
isBold = false;
return STYLE_COMMENT_INDEX;
case IDC_COMMENTLINE_BOLD_CHECK :
isBold = true;
return STYLE_COMMENTLINE_INDEX;
case IDC_COMMENTLINE_ITALIC_CHECK :
isBold = false;
return STYLE_COMMENTLINE_INDEX;
case IDC_NUMBER_BOLD_CHECK :
isBold = true;
return STYLE_NUMBER_INDEX;
case IDC_NUMBER_ITALIC_CHECK :
isBold = false;
return STYLE_NUMBER_INDEX;
default :
return -1;
}
};
private :
void convertTo(char *dest, const char *toConvert, char prefix) const {
int index = strlen(dest);
dest[index++] = ' ';
dest[index++] = prefix;
for (int i = 0 ; i < strlen(toConvert) ; i++)
{
if (toConvert[i] == ' ')
{
if (toConvert[i+1] != ' ')
{
dest[index++] = ' ';
dest[index++] = prefix;
}
}
else
{
dest[index++] = toConvert[i];
}
}
dest[index] = '\0';
};
void retrieve(char *dest, const char *toRetrieve, char prefix) const {
int j = 0;
bool begin2Copy = false;
for (int i = 0 ; i < strlen(toRetrieve) ; i++)
{
if (((i == 0) || toRetrieve[i-1] == ' ') && (toRetrieve[i] == prefix))
{
begin2Copy = true;
continue;
}
else if (((toRetrieve[i] == ' ') && begin2Copy == true))
{
dest[j++] = toRetrieve[i];
begin2Copy = false;
}
if (begin2Copy)
dest[j++] = toRetrieve[i];
}
dest[j++] = '\0';
};
};
class SymbolsStyleDialog : public SharedParametersDialog
{
public :
static const bool ADD;
static const bool REMOVE;
void updateDlg();
protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
void setKeywords2List(int ctrlID) {};
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const {
isFontSize = (ctrlID == IDC_SYMBOL_FONTSIZE_COMBO);
return STYLE_OPERATOR_INDEX;
};
int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const;
int getGroupeIndexFromCheck(int ctrlID, bool & isBold) const {
isBold = (ctrlID == IDC_SYMBOL_BOLD_CHECK);
return STYLE_OPERATOR_INDEX;
};
private :
void symbolAction(bool action);
void listboxsRemoveAll();
void listboxsInit();
void listboxsReInit() {
listboxsRemoveAll();
listboxsInit();
};
};
class UserDefineDialog : public SharedParametersDialog
{
friend class ScintillaEditView;
public :
UserDefineDialog();//: SharedParametersDialog(), _status(UNDOCK){};
~UserDefineDialog();//{};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView *pSev) {
if (!_pScintilla)
{
Window::init(hInst, hPere);
_pScintilla = pSev;
}
};
void setScintilla(ScintillaEditView *pScinView) {
_pScintilla = pScinView;
};
virtual void UserDefineDialog::create(int dialogID) {
StaticDialog::create(dialogID);
}
int getWidth() const {
return _dlgPos.right;
};
int getHeight() const {
return _dlgPos.bottom;
};
void doDialog(bool willBeShown = true) {
if (!isCreated())
create(IDD_GLOBAL_USERDEFINE_DLG);
display(willBeShown);
};
virtual void reSizeTo(RECT & rc) // should NEVER be const !!!
{
Window::reSizeTo(rc);
display(false);
display();
};
void changeStyle();
bool isDocked() const {return _status == DOCK;};
int getNbKeywordList() {return nbKeywodList;};
bool isDirty() const {return _isDirty;};
protected :
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private :
ControlsTab _ctrlTab;
WindowVector _wVector;
UserLangContainer *_pCurrentUserLang;
FolderStyleDialog _folderStyleDlg;
KeyWordsStyleDialog _keyWordsStyleDlg;
CommentStyleDialog _commentStyleDlg;
SymbolsStyleDialog _symbolsStyleDlg;
bool _status;
RECT _dlgPos;
//ScintillaEditView *_pScintilla;
bool _isDirty;
void getActualPosSize() {
::GetWindowRect(_hSelf, &_dlgPos);
_dlgPos.right -= _dlgPos.left;
_dlgPos.bottom -= _dlgPos.top;
};
void restorePosSize(){reSizeTo(_dlgPos);};
void enableLangAndControlsBy(int index);
protected :
void setKeywords2List(int ctrlID){};
int getGroupIndexFromCombo(int ctrlID, bool & isFontSize) const {return -1;};
int getStylerIndexFromCP(HWND hWnd, bool & isFG, ColourPicker **ppCP) const {return -1;};
int getGroupeIndexFromCheck(int ctrlID, bool & isBold) const {return -1;};
void updateDlg() {
_folderStyleDlg.updateDlg();
_keyWordsStyleDlg.updateDlg();
_commentStyleDlg.updateDlg();
_symbolsStyleDlg.updateDlg();
};
};
class StringDlg : public StaticDialog
{
public :
StringDlg() : StaticDialog() {};
void init(HINSTANCE hInst, HWND parent, char *title, char *staticName, char *text2Set) {
Window::init(hInst, parent);
strcpy(_title, title);
strcpy(_static, staticName);
strcpy(_textValue, text2Set);
};
int doDialog() {
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_STRING_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this);
};
virtual void destroy() {};
protected :
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message)
{
case WM_INITDIALOG :
{
::SetWindowText(_hSelf, _title);
::SetDlgItemText(_hSelf, IDC_STRING_STATIC, _static);
::SetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue);
return TRUE;
}
case WM_COMMAND :
{
switch (wParam)
{
case IDOK :
{
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, _textValue, 256);
::EndDialog(_hSelf, int(_textValue));
return TRUE;
}
case IDCANCEL :
::EndDialog(_hSelf, int(NULL));
return TRUE;
default:
return FALSE;
}
}
default :
return FALSE;
}
return FALSE;
}
private :
char _title[64];
char _textValue[256];
char _static[32];
//POINT _p;
};
#endif //USER_DEFINE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -