[UPDATE] Unprecompile headers

This commit is contained in:
Don Ho 2015-05-31 15:57:17 +02:00
parent 17e8ca3c15
commit b35e759d11
29 changed files with 148 additions and 153 deletions

View File

@ -29,6 +29,11 @@
#ifndef M30_IDE_COMMUN_H
#define M30_IDE_COMMUN_H
#include <vector>
#include <string>
#include <windows.h>
const bool dirUp = true;
const bool dirDown = false;

View File

@ -70,14 +70,12 @@
#include <dbghelp.h>
#pragma warning(pop)
#include <eh.h>
#ifdef UNICODE
#include <wchar.h>
#endif
// Notepad++
#include "Common.h"
#include "Window.h"
#include "StaticDialog.h"
#endif PRECOMPILEHEADER_H
#endif //PRECOMPILEHEADER_H

View File

@ -77,8 +77,8 @@ extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *);
extern "C" __declspec(dllexport) void beNotified(SCNotification *);
extern "C" __declspec(dllexport) LRESULT messageProc(UINT Message, WPARAM wParam, LPARAM lParam);
#ifdef UNICODE
// This API return always true now, since Notepad++ isn't compiled in ANSI mode anymore
extern "C" __declspec(dllexport) BOOL isUnicode();
#endif //UNICODE
#endif //PLUGININTERFACE_H

View File

@ -1970,11 +1970,8 @@ void Notepad_plus::deleteMarkedLines(bool isMarked)
void Notepad_plus::pasteToMarkedLines()
{
int clipFormat;
#ifdef UNICODE
clipFormat = CF_UNICODETEXT;
#else
clipFormat = CF_TEXT;
#endif
BOOL canPaste = ::IsClipboardFormatAvailable(clipFormat);
if (!canPaste)
return;
@ -4565,9 +4562,7 @@ bool Notepad_plus::str2Cliboard(const TCHAR *str2cpy)
len2Allocate *= sizeof(TCHAR);
unsigned int cilpboardFormat = CF_TEXT;
#ifdef UNICODE
cilpboardFormat = CF_UNICODETEXT;
#endif
HGLOBAL hglbCopy = ::GlobalAlloc(GMEM_MOVEABLE, len2Allocate);
if (hglbCopy == NULL)
@ -5546,7 +5541,6 @@ Quote quotes[nbQuote] = {
{"Bob Gray", "Writing in C or C++ is like running a chain saw with all the safety guards removed."},
{"Roberto Waltman", "In the one and only true way. The object-oriented version of \"Spaghetti code\" is, of course, \"Lasagna code\". (Too many layers)"},
{"Gavin Russell Baker", "C++ : Where friends have access to your private members."},
{"Alanna", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."},
{"Linus Torvalds", "Software is like sex: It's better when it's free."},
{"Cult of vi", "Emacs is a great operating system, lacking only a decent editor."},
{"Church of Emacs", "vi has two modes - \"beep repeatedly\" and \"break everything\"."},
@ -5642,7 +5636,7 @@ Quote quotes[nbQuote] = {
{"Anonymous #81", "A male engineering student was crossing a road one day when a frog called out to him and said, \"If you kiss me, I'll turn into a beautiful princess.\" He bent over, picked up the frog, and put it in his pocket.\n\nThe frog spoke up again and said, \"If you kiss me and turn me back into a beautiful princess, I will stay with you for one week.\" The engineering student took the frog out of his pocket, smiled at it; and returned it to his pocket.\n\nThe frog then cried out, \"If you kiss me and turn me back into a princess, I'll stay with you and do ANYTHING you want.\" Again the boy took the frog out, smiled at it, and put it back into his pocket.\n\nFinally, the frog asked, \"What is the matter? I've told you I'm a beautiful princess, that I'll stay with you for a week and do anything you want. Why won't you kiss me?\" The boy said, \"Look I'm an engineer. I don't have time for a girlfriend, but a talking frog is cool.\"\n"},
{"Anonymous #82", "Programmers never die.\nThey just go offline."},
{"Anonymous #83", "Copy from one, it's plagiarism.\nCopy from two, it's research."},
//{"Anonymous #84", ""},
{"Anonymous #84", "Saying that Java is nice because it works on all OSes is like saying that anal sex is nice because it works on all genders."},
{"Anonymous #85", "Race, religion, ethnic pride and nationalism etc... does nothing but teach you how to hate people that you've never met."},
{"Anonymous #86", "Farts are just the ghosts of the things we eat."},
{"Anonymous #87", "I promised I would never kill someone who had my blood.\nBut that mosquito made me break my word."},

View File

@ -32,6 +32,7 @@
#include "ScintillaEditView.h"
#include "keys.h"
#include "localization.h"
#include "localizationString.h"
#include "UserDefineDialog.h"
#include "../src/sqlite/sqlite3.h"
@ -496,8 +497,6 @@ static int getKwClassFromName(const TCHAR *str) {
return -1;
};
#ifdef UNICODE
#include "localizationString.h"
wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const
{
@ -541,8 +540,6 @@ bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const
return ::CopyFileW(langPath.c_str(), _nativeLangPath.c_str(), FALSE) != FALSE;
}
#endif
generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
{
@ -1843,9 +1840,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (!root)
return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu");
if (contextMenuRoot)
@ -1859,13 +1854,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string folderName;
generic_string displayAs;
#ifdef UNICODE
folderName = folderNameA?wmc->char2wchar(folderNameA, SC_CP_UTF8):TEXT("");
displayAs = displayAsA?wmc->char2wchar(displayAsA, SC_CP_UTF8):TEXT("");
#else
folderName = folderNameA?folderNameA:"";
displayAs = displayAsA?displayAsA:"";
#endif
int id;
const char *idStr = (childNode->ToElement())->Attribute("id", &id);
if (idStr)
@ -1879,13 +1870,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string menuEntryName;
generic_string menuItemName;
#ifdef UNICODE
menuEntryName = menuEntryNameA?wmc->char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT("");
menuItemName = menuItemNameA?wmc->char2wchar(menuItemNameA, SC_CP_UTF8):TEXT("");
#else
menuEntryName = menuEntryNameA?menuEntryNameA:"";
menuItemName = menuItemNameA?menuItemNameA:"";
#endif
if (menuEntryName != TEXT("") && menuItemName != TEXT(""))
{
int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle);
@ -1949,13 +1936,9 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
generic_string pluginName;
generic_string pluginCmdName;
#ifdef UNICODE
pluginName = pluginNameA?wmc->char2wchar(pluginNameA, SC_CP_UTF8):TEXT("");
pluginCmdName = pluginCmdNameA?wmc->char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT("");
#else
pluginName = pluginNameA?pluginNameA:"";
pluginCmdName = pluginCmdNameA?pluginCmdNameA:"";
#endif
// if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid
if (pluginsMenu && pluginName != TEXT("") && pluginCmdName != TEXT(""))
{
@ -6417,3 +6400,62 @@ void NppParameters::safeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirect
}
}
Date::Date(const TCHAR *dateStr)
{
// timeStr should be Notepad++ date format : YYYYMMDD
assert(dateStr);
if (lstrlen(dateStr) == 8)
{
generic_string ds(dateStr);
generic_string yyyy(ds, 0, 4);
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
int y = generic_atoi(yyyy.c_str());
int m = generic_atoi(mm.c_str());
int d = generic_atoi(dd.c_str());
if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31))
{
_year = y;
_month = m;
_day = d;
return;
}
}
now();
}
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
// if the value of nbDaysFromNow is 0 then the date will be now
Date::Date(int nbDaysFromNow)
{
const time_t oneDay = (60 * 60 * 24);
time_t rawtime;
tm* timeinfo;
time(&rawtime);
rawtime += (nbDaysFromNow * oneDay);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year + 1900;
_month = timeinfo->tm_mon + 1;
_day = timeinfo->tm_mday;
}
void Date::now()
{
time_t rawtime;
tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year + 1900;
_month = timeinfo->tm_mon + 1;
_day = timeinfo->tm_mday;
}

View File

@ -69,7 +69,7 @@
#include "dpiManager.h"
#endif //DPIMANAGER_H
#include <assert.h>
#include <tchar.h>
class NativeLangSpeaker;
@ -402,13 +402,6 @@ public:
Style & getStyler(int index) {
assert(index >= 0 && index < SCE_STYLE_ARRAY_SIZE);
/*
if (index < 0 || index >= SCE_STYLE_ARRAY_SIZE)
{
Style s;
return s;
}
*/
return _styleArray[index];
};
@ -416,7 +409,6 @@ public:
void addStyler(int styleID, TiXmlNode *styleNode);
void addStyler(int styleID, const TCHAR *styleName) {
//ZeroMemory(&_styleArray[_nbStyler], sizeof(Style));;
_styleArray[styleID]._styleID = styleID;
_styleArray[styleID]._styleDesc = styleName;
_styleArray[styleID]._fgColor = black;
@ -605,61 +597,14 @@ public:
_day = day;
};
Date(const TCHAR *dateStr) { // timeStr should be Notepad++ date format : YYYYMMDD
assert(dateStr);
if (lstrlen(dateStr) == 8)
{
generic_string ds(dateStr);
generic_string yyyy(ds, 0, 4);
generic_string mm(ds, 4, 2);
generic_string dd(ds, 6, 2);
int y = generic_atoi(yyyy.c_str());
int m = generic_atoi(mm.c_str());
int d = generic_atoi(dd.c_str());
if ((y > 0 && y <= 9999) && (m > 0 && m <= 12) && (d > 0 && d <= 31))
{
_year = y;
_month = m;
_day = d;
return;
}
}
now();
};
Date(const TCHAR *dateStr);
// The constructor which makes the date of number of days from now
// nbDaysFromNow could be negative if user want to make a date in the past
// if the value of nbDaysFromNow is 0 then the date will be now
Date(int nbDaysFromNow)
{
const time_t oneDay = (60 * 60 * 24);
Date(int nbDaysFromNow);
time_t rawtime;
tm* timeinfo;
time(&rawtime);
rawtime += (nbDaysFromNow * oneDay);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year+1900;
_month = timeinfo->tm_mon+1;
_day = timeinfo->tm_mday;
}
void now() {
time_t rawtime;
tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
_year = timeinfo->tm_year+1900;
_month = timeinfo->tm_mon+1;
_day = timeinfo->tm_mday;
};
void now();
generic_string toString() { // Return Notepad++ date format : YYYYMMDD
TCHAR dateStr[8+1];

View File

@ -345,7 +345,6 @@ bool AutoCompletion::showWordComplete(bool autoInsert)
words += TEXT(" ");
}
// UNICODE TO DO
_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
_pEditView->showAutoComletion(curPos - startPos, words.c_str());

View File

@ -25,7 +25,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include "SmartHighlighter.h"
#include "ScintillaEditView.h"
#include "FindReplaceDlg.h"

View File

@ -56,6 +56,11 @@ distribution.
#define TIXMLA_OSTREAM TiXmlOutStreamA
#endif
#include <stdio.h>
#include <assert.h>
#include <string>
#include <tchar.h>
class TiXmlDocumentA;
class TiXmlElementA;
class TiXmlCommentA;

View File

@ -50,14 +50,18 @@ distribution.
#define TIXML_STRING generic_string
#define TIXML_ISTREAM std::basic_istream<TCHAR>
#define TIXML_OSTREAM std::basic_ostream<TCHAR>
#else
#include "tinystr.h"
#define TIXML_STRING TiXmlString
#define TIXML_OSTREAM TiXmlOutStream
#endif
#include <assert.h>
#include <string>
#include "Common.h"
class TiXmlDocument;
class TiXmlElement;
class TiXmlComment;

View File

@ -26,7 +26,10 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <Shlobj.h>
#include <uxtheme.h>
#include "AboutDlg.h"
#include "Parameters.h"
@ -39,17 +42,11 @@ BOOL CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME);
generic_string buildTime = TEXT("Build time : ");
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
buildTime += wmc->char2wchar(__DATE__, CP_ACP);
buildTime += TEXT(" - ");
buildTime += wmc->char2wchar(__TIME__, CP_ACP);
#else
buildTime += __DATE__;
buildTime += TEXT(" - ");
buildTime += __TIME__;
#endif
::SendMessage(compileDateHandle, WM_SETTEXT, 0, (LPARAM)buildTime.c_str());
::EnableWindow(compileDateHandle, FALSE);

View File

@ -37,6 +37,8 @@
#include "resource.h"
#endif// RESOURCE_H
#include "StaticDialog.h"
#define LICENCE_TXT \
TEXT("This program is free software; you can redistribute it and/or \
modify it under the terms of the GNU General Public License \

View File

@ -29,6 +29,9 @@
#ifndef URLCTRL_INCLUDED
#define URLCTRL_INCLUDED
#include "Window.h"
#include "Common.h"
class URLCtrl : public Window {
public:
URLCtrl():_hfUnderlined(0),_hCursor(0), _msgDest(NULL), _cmdID(0), _oldproc(NULL), \

View File

@ -36,6 +36,9 @@
#include "Docking.h"
#endif //DOCKING_H
#include <assert.h>
#include <shlwapi.h>
class DockingDlgInterface : public StaticDialog
{
public:
@ -49,7 +52,7 @@ public:
StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH];
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
_moduleName = PathFindFileName(temp);
_moduleName = ::PathFindFileName(temp);
};
void create(tTbData * data, bool isRTL = false){

View File

@ -29,6 +29,8 @@
#ifndef IMAGE_LIST_H
#define IMAGE_LIST_H
#include <commctrl.h>
const int nbMax = 45;
#define IDI_SEPARATOR_ICON -1

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <shlwapi.h>
#include "FileDialog.h"
#include "Parameters.h"

View File

@ -29,6 +29,9 @@
#ifndef FILE_DIALOG_H
#define FILE_DIALOG_H
#include "Common.h"
#include "Notepad_plus_msgs.h"
const int nbExtMax = 256;
const int extLenMax = 64;
@ -72,8 +75,6 @@ private:
OPENFILENAME _ofn;
winVer _winVersion;
//TCHAR _extArray[nbExtMax][extLenMax];
int _nbExt;
int _extTypeIndex;
static FileDialog *staticThis;

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <iostream>
#include <windows.h>
#include "Splitter.h"
bool Splitter::_isHorizontalRegistered = false;

View File

@ -33,6 +33,8 @@
#include "resource.h"
#endif //RESOURCE_H
#include "Window.h"
#define SV_HORIZONTAL 0x00000001
#define SV_VERTICAL 0x00000002
#define SV_FIXED 0x00000004

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <iostream>
#include <windows.h>
#include "SplitterContainer.h"
bool SplitterContainer::_isRegistered = false;

View File

@ -25,8 +25,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <stdio.h>
#include <windows.h>
#include "StaticDialog.h"
void StaticDialog::goToCenter()
{

View File

@ -33,6 +33,8 @@
#include "Notepad_plus_msgs.h"
#endif //NOTEPAD_PLUS_MSGS_H
#include "Window.h"
typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
enum PosAlign{ALIGNPOS_LEFT, ALIGNPOS_RIGHT, ALIGNPOS_TOP, ALIGNPOS_BOTTOM};

View File

@ -26,7 +26,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "precompiledHeaders.h"
#include <windows.h>
#include <commctrl.h>
#include "StatusBar.h"
//#define IDC_STATUSBAR 789
@ -85,3 +86,17 @@ void StatusBar::adjustParts(int clientWidth)
// Tell the status bar to create the window parts.
::SendMessage(_hSelf, SB_SETPARTS, (WPARAM)_nbParts, (LPARAM)_lpParts);
}
bool StatusBar::setText(const TCHAR *str, int whichPart)
{
if (whichPart > _nbParts)
return false;
_lastSetText = str;
return (::SendMessage(_hSelf, SB_SETTEXT, whichPart, (LPARAM)_lastSetText.c_str()) == TRUE);
}
bool StatusBar::setOwnerDrawText(const TCHAR *str)
{
_lastSetText = str;
return (::SendMessage(_hSelf, SB_SETTEXT, SBT_OWNERDRAW, (LPARAM)_lastSetText.c_str()) == TRUE);
}

View File

@ -33,6 +33,9 @@
#define _WIN32_IE 0x0600
#endif //_WIN32_IE
#include "Window.h"
#include "Common.h"
class StatusBar : public Window
{
public :
@ -73,18 +76,8 @@ public :
return Window::getHeight();
};
bool setText(const TCHAR *str, int whichPart) {
if (whichPart > _nbParts)
return false;
_lastSetText = str;
return (::SendMessage(_hSelf, SB_SETTEXT, whichPart, (LPARAM)_lastSetText.c_str()) == TRUE);
};
bool setOwnerDrawText(const TCHAR *str) {
_lastSetText = str;
return (::SendMessage(_hSelf, SB_SETTEXT, SBT_OWNERDRAW, (LPARAM)_lastSetText.c_str()) == TRUE);
};
bool setText(const TCHAR *str, int whichPart);
bool setOwnerDrawText(const TCHAR *str);
void adjustParts(int clientWidth);
private :

View File

@ -33,6 +33,9 @@
#include "Notepad_plus_msgs.h"
#endif //NOTEPAD_PLUS_MSGS_H
#include "Window.h"
#include "ImageListSet.h"
#define REBAR_BAR_TOOLBAR 0
#define REBAR_BAR_SEARCH 1
@ -45,8 +48,6 @@ using namespace std;
enum toolBarStatusType {/*TB_HIDE, */TB_SMALL, TB_LARGE, TB_STANDARD};
#include "ImageListSet.h"
typedef struct {
UINT message; // identification of icon in tool bar (menu ID)

View File

@ -29,6 +29,8 @@
#ifndef WINDOW_CONTROL_H
#define WINDOW_CONTROL_H
#include <windows.h>
class Window
{
public:

View File

@ -422,7 +422,6 @@ bool WindowsDlg::changeDlgLang()
{
if (!_dlgNode) return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
int nativeLangEncoding = CP_ACP;
TiXmlDeclarationA *declaration = _dlgNode->GetDocument()->FirstChild()->ToDeclaration();
@ -432,18 +431,13 @@ bool WindowsDlg::changeDlgLang()
EncodingMapper *em = EncodingMapper::getInstance();
nativeLangEncoding = em->getEncodingFromString(encodingStr);
}
#endif
// Set Title
const char *titre = (_dlgNode->ToElement())->Attribute("title");
if (titre && titre[0])
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(titre, nativeLangEncoding);
::SetWindowText(_hSelf, nameW);
#else
::SetWindowText(_hSelf, titre);
#endif
}
// Set the text of child control
@ -460,12 +454,8 @@ bool WindowsDlg::changeDlgLang()
HWND hItem = ::GetDlgItem(_hSelf, id);
if (hItem)
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, nativeLangEncoding);
::SetWindowText(hItem, nameW);
#else
::SetWindowText(hItem, name);
#endif
}
}
}

View File

@ -611,19 +611,10 @@ recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam, int
case IDD_FINDINFILES_DIR_COMBO:
case IDD_FINDINFILES_FILTERS_COMBO:
{
#ifdef UNICODE
char *ch = reinterpret_cast<char *>(lParameter);
TCHAR tch[2];
::MultiByteToWideChar(codepage, 0, ch, -1, tch, 2);
sParameter = *tch;
#else
char ch = *reinterpret_cast<char *>(lParameter);
TCHAR tch = ch;
sParameter = tch;
// dummy call
codepage = 0;
#endif
MacroType = mtUseSParameter;
lParameter = 0;
}
@ -644,17 +635,11 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
else
{
long lParam = lParameter;
#ifdef UNICODE
char ansiBuffer[3];
#endif
if (MacroType == mtUseSParameter)
{
#ifdef UNICODE
::WideCharToMultiByte(pEditView->execute(SCI_GETCODEPAGE), 0, sParameter.c_str(), -1, ansiBuffer, 3, NULL, NULL);
lParam = reinterpret_cast<LPARAM>(ansiBuffer);
#else
lParam = reinterpret_cast<LPARAM>(sParameter.c_str());
#endif
}
pEditView->execute(message, wParameter, lParam);

View File

@ -37,6 +37,8 @@
#include "Scintilla.h"
#endif //SCINTILLA_H
#include "StaticDialog.h"
using namespace std;
const size_t nameLenMax = 64;