Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Config/PluginConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void PluginConfig::settings()
{
::SendMessage(nppData._nppHandle, NPPM_DOOPEN, 0, (LPARAM)iniPath);
}
int lineCount = ::SendScintilla(SCI_GETLINECOUNT, 0, 0)-1;
sptr_t lineCount = ::SendScintilla(SCI_GETLINECOUNT, 0, 0)-1;
::SendScintilla(SCI_ANNOTATIONCLEARALL, 0, 0);
//TODO: move this part (and other text) to const char in another file.
::SendScintilla(SCI_ANNOTATIONSETTEXT, lineCount, (LPARAM)"\
Expand Down Expand Up @@ -390,7 +390,7 @@ For step by step usage guide, please visit http://github.com/erinata/FingerText
void PluginConfig::about()
{

int length = _tcslen(TEXT(PLUGIN_NAME))+_tcslen(TEXT(VERSION_TEXT))+_tcslen(TEXT(VERSION_STAGE))+_tcslen(TEXT(VERSION_STAGE_ADD))+_tcslen(TEXT(DATE_TEXT))+_tcslen(TEXT(AUTHOR_TEXT))+_tcslen(TEXT(EMAIL_TEXT))+_tcslen(TEXT(ABOUT_TEXT))+50;
sptr_t length = _tcslen(TEXT(PLUGIN_NAME))+_tcslen(TEXT(VERSION_TEXT))+_tcslen(TEXT(VERSION_STAGE))+_tcslen(TEXT(VERSION_STAGE_ADD))+_tcslen(TEXT(DATE_TEXT))+_tcslen(TEXT(AUTHOR_TEXT))+_tcslen(TEXT(EMAIL_TEXT))+_tcslen(TEXT(ABOUT_TEXT))+50;

TCHAR* versionText = new TCHAR[length];

Expand Down
24 changes: 12 additions & 12 deletions Dialogs/InsertionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int InsertionDlg::getEditPos()

TCHAR* InsertionDlg::getEditText()
{
int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
TCHAR* bufferWide = new TCHAR[length+1];
::GetDlgItemText(_hSelf, IDC_INSERTION_EDIT ,bufferWide,length+1);
return bufferWide;
Expand Down Expand Up @@ -137,13 +137,13 @@ void InsertionDlg::setDlgText(int dlg, TCHAR* showText)

}

void InsertionDlg::getSelectText(TCHAR* &buffer, int index)
void InsertionDlg::getSelectText(TCHAR* &buffer, LRESULT index)
{

HWND hwndList = GetDlgItem(_hSelf, IDC_INSERTION_LIST);
if (index = -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
if (index == -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
if (index <= 0) index = 0;
int length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0);
LRESULT length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0);
if (length >= 1)
{

Expand Down Expand Up @@ -242,7 +242,7 @@ bool InsertionDlg::completeSnippets()
bool retVal = false;
SendDlgItemMessage(_hSelf, IDC_INSERTION_LIST, LB_SETSEL, 0, 0);
showPreview(false,true);
int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
SendDlgItemMessage(_hSelf, IDC_INSERTION_EDIT, EM_SETSEL, length, -1);
//TODO: complete snippet in dialog

Expand All @@ -267,11 +267,11 @@ void InsertionDlg::changeMode(bool withComment)

void InsertionDlg::setTextTarget(bool fromTab)
{
int index = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCURSEL, 0, 0);
LRESULT index = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCURSEL, 0, 0);

if ((fromTab) || (index)==0)
{
int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
SetFocus(GetDlgItem(_hSelf, IDC_INSERTION_EDIT));
SendDlgItemMessage(_hSelf, IDC_INSERTION_EDIT, EM_SETSEL, length, -1);
}
Expand All @@ -280,7 +280,7 @@ void InsertionDlg::setTextTarget(bool fromTab)

void InsertionDlg::setListTarget()
{
int count = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCOUNT, 0, 0);
LRESULT count = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCOUNT, 0, 0);
if (count>0)
{
SetFocus(GetDlgItem(_hSelf, IDC_INSERTION_LIST));
Expand All @@ -293,7 +293,7 @@ void InsertionDlg::updateInsertionHint()
{
if (::GetFocus() == GetDlgItem(_hSelf, IDC_INSERTION_EDIT))
{
int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0);
if (length>0)
{
TCHAR* bufferWide = new TCHAR[length+1];
Expand Down Expand Up @@ -325,9 +325,9 @@ void InsertionDlg::adjustTextHintPosition()
{
int fontWidth = 7;
int offset = 4;
int length1 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT), EM_LINELENGTH, 0, 0);
int length2 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT), EM_LINELENGTH, 0, 0);
int length3 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_POST), EM_LINELENGTH, 0, 0);
LRESULT length1 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT), EM_LINELENGTH, 0, 0);
LRESULT length2 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT), EM_LINELENGTH, 0, 0);
LRESULT length3 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_POST), EM_LINELENGTH, 0, 0);

SetWindowPos(GetDlgItem(_hSelf, IDC_INSERTION_HINT) ,NULL,5 ,35,offset+length1*fontWidth,20,SWP_NOACTIVATE);
SetWindowPos(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT),NULL,5+offset+length1*fontWidth ,35,offset+length2*fontWidth,20,SWP_NOACTIVATE);
Expand Down
2 changes: 1 addition & 1 deletion Dialogs/InsertionDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class InsertionDlg : public StaticDialog
void InsertionDlg::setListTarget();
bool InsertionDlg::completeSnippets();
int InsertionDlg::getEditPos();
void InsertionDlg::getSelectText(TCHAR* &buffer, int index = -1);
void InsertionDlg::getSelectText(TCHAR* &buffer, LRESULT index = -1);
void InsertionDlg::setDlgText(int dlg, TCHAR* showText);
void InsertionDlg::changeMode(bool withComment);
void InsertionDlg::changeExpand();
Expand Down
30 changes: 15 additions & 15 deletions Dialogs/SnippetDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "SnippetDock.h"

bool normalMode = true;
int insertMode = 1;
LRESULT insertMode = 1;
//int previewMode = 1;
int selectMode = 1;
//extern NppData nppData;
Expand Down Expand Up @@ -71,7 +71,7 @@ void DockingDlg::resizeListBox(int height,int width)

int minimumHeight = 100;

if (height = -1)
if (height == -1)
{
RECT rect;
GetWindowRect(_hSelf, &rect);
Expand Down Expand Up @@ -147,9 +147,9 @@ void DockingDlg::toggleSave(bool buttonOn)
}


int DockingDlg::getSelection()
LRESULT DockingDlg::getSelection()
{
int retVal;
LRESULT retVal;
HWND hwndList = GetDlgItem(_hSelf, IDC_SNIPPET_LIST);
retVal = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
retVal = SendMessage(hwndList, LB_GETANCHORINDEX, 0, 0);
Expand All @@ -158,13 +158,13 @@ int DockingDlg::getSelection()

}

void DockingDlg::getSelectText(TCHAR* &buffer, int index)
void DockingDlg::getSelectText(TCHAR* &buffer, LRESULT index)
{

HWND hwndList = GetDlgItem(_hSelf, IDC_SNIPPET_LIST);
if (index = -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
if (index == -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
if (index <= 0) index = 0;
int length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0);
LRESULT length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0);
if (length >= 1)
{

Expand Down Expand Up @@ -204,30 +204,30 @@ void DockingDlg::setupHotspotCombo()



int DockingDlg::searchSnippetList(wchar_t* key)
LRESULT DockingDlg::searchSnippetList(wchar_t* key)
{
return SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_FINDSTRINGEXACT, -1, (LPARAM)key);
}

void DockingDlg::setTopIndex(int index)
void DockingDlg::setTopIndex(LRESULT index)
{
SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_SETTOPINDEX, index, 0);
}

int DockingDlg::getTopIndex()
LRESULT DockingDlg::getTopIndex()
{
return SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_GETTOPINDEX, 0, 0);
}

void DockingDlg::selectSnippetList(int selection)
void DockingDlg::selectSnippetList(LRESULT selection)
{
SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_SETCURSEL, selection, 0);
}


void DockingDlg::insertHotspot()
{
int type = SendMessage(GetDlgItem(_hSelf, IDC_COMBO_HOTSPOT), CB_GETCURSEL, 0, 0);
LRESULT type = SendMessage(GetDlgItem(_hSelf, IDC_COMBO_HOTSPOT), CB_GETCURSEL, 0, 0);
//::insertHotSpotSign(select);
insertTagSign(type);
::SetFocus(::getCurrentScintilla());
Expand Down Expand Up @@ -350,7 +350,7 @@ void DockingDlg::switchDock(bool toNormal)
//alert();
}

void DockingDlg::switchInsertMode(int insert)
void DockingDlg::switchInsertMode(LRESULT insert)
{
insertMode = insert;
SendMessage(GetDlgItem(_hSelf, IDC_RADIO_INSERT), BM_SETCHECK, insert, 0);
Expand Down Expand Up @@ -452,11 +452,11 @@ INT_PTR CALLBACK DockingDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
{
if (::GetFocus() == GetDlgItem(_hSelf, IDC_FILTER))
{
int length = SendMessage(GetDlgItem(_hSelf, IDC_FILTER), EM_LINELENGTH, 0, 0);
LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_FILTER), EM_LINELENGTH, 0, 0);
if (length>0)
{
TCHAR* bufferWide = new TCHAR[length+1];
::GetDlgItemText(_hSelf, IDC_FILTER ,bufferWide,length+1);
::GetDlgItemText(_hSelf, IDC_FILTER ,bufferWide,(int)(length+1));
char* buffer = toCharArray(bufferWide);
bool leadingSpace = 0;
bool trailingSpace = 0;
Expand Down
14 changes: 7 additions & 7 deletions Dialogs/SnippetDock.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ class DockingDlg : public DockingDlgInterface
void clearDock();
void setDlgText(int dlg, TCHAR* showText);
void toggleSave(bool buttonOn);
int getSelection();
LRESULT getSelection();
//void setSelction();
void DockingDlg::setupHotspotCombo();
void DockingDlg::switchInsertMode(int insert = 1);
void DockingDlg::switchInsertMode(LRESULT insert = 1);
//int getCount();
void DockingDlg::updateSnippetCount(wchar_t* count);
void DockingDlg::insertHotspot();
void DockingDlg::switchDock(bool toNormal = true);
void DockingDlg::selectSnippetList(int selection);
int DockingDlg::searchSnippetList(wchar_t* key);
int DockingDlg::getTopIndex();
void DockingDlg::setTopIndex(int index);
void DockingDlg::getSelectText(TCHAR* &buffer, int index = -1);
void DockingDlg::selectSnippetList(LRESULT selection);
LRESULT DockingDlg::searchSnippetList(wchar_t* key);
LRESULT DockingDlg::getTopIndex();
void DockingDlg::setTopIndex(LRESULT index);
void DockingDlg::getSelectText(TCHAR* &buffer, LRESULT index = -1);

protected :

Expand Down
14 changes: 7 additions & 7 deletions DuckEval/DuckEval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ bool Expression::isDigit(const char &c)

std::string Expression::rephrasing(std::string input)
{
int length = input.length();
for (int j=0; j<length; ++j) input[j]=tolower(input[j]);
size_t length = input.length();
for (size_t j=0; j<length; ++j) input[j]=tolower(input[j]);

//Operators
signReplace(input,"==","=");
Expand Down Expand Up @@ -415,7 +415,7 @@ int Expression::isNotEqual(double operand1, double operand2)
else return 1;
}

long Expression::ncr(long operand1, long operand2)
double Expression::ncr(double operand1, double operand2)
{
if (operand1 < 0 || operand2 < 0 || operand1 > operand2)
{
Expand All @@ -427,7 +427,7 @@ long Expression::ncr(long operand1, long operand2)
return factorial(operand2)/(factorial(operand1)*factorial(operand2 - operand1));
}

long Expression::npr(long operand1, long operand2)
double Expression::npr(double operand1, double operand2)
{
if (operand1 < 0 || operand2 < 0 || operand1 > operand2)
{
Expand All @@ -438,11 +438,11 @@ long Expression::npr(long operand1, long operand2)
return factorial(operand2)/factorial(operand2 - operand1);
}

long Expression::factorial(long number)
double Expression::factorial(double number)
{
if (number < 0) isError = 1;
long result = 1;
for (long i = number; i>0; i--) result = result * i;
double result = 1;
for (double i = number; i>0; i--) result = result * i;
return result;
}

Expand Down
6 changes: 3 additions & 3 deletions DuckEval/DuckEval.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Expression
void Expression::toPostfix(std::string infix);
double Expression::operate(const std::string &, const double &, const double &); // calculate result by operator and operand
void Expression::signReplace(std::string& str, const std::string& oldStr, const std::string& newStr,bool negative = false);
long Expression::factorial(long number);
double Expression::factorial(double number);
int Expression::isNotEqual(double operand1, double operand2);
int Expression::isEqual(double operand1, double operand2);
int Expression::isSmallerOrEqual(double operand1, double operand2);
Expand All @@ -58,8 +58,8 @@ class Expression
int Expression::isGreater(double operand1, double operand2);
int Expression::operateOr(double operand1, double operand2);
int Expression::operateAnd(double operand1, double operand2);
long Expression::ncr(long operand1, long operand2);
long Expression::npr(long operand1, long operand2);
double Expression::ncr(double operand1, double operand2);
double Expression::npr(double operand1, double operand2);
long Expression::randomNumber(double operand1);
double Expression::randomFraction(double operand1);

Expand Down
10 changes: 5 additions & 5 deletions FingerText.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Unicode Debug|Win32">
<Configuration>Unicode Debug</Configuration>
Expand Down Expand Up @@ -30,26 +30,26 @@
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120_xp</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
8 changes: 4 additions & 4 deletions NppApi/NppApiHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ int showMessageBox(TCHAR* text, int flags)
return ::MessageBox(nppData._nppHandle, text, TEXT(PLUGIN_NAME), flags);
}

int searchNext(char* searchText, bool regExp)
sptr_t searchNext(char* searchText, bool regExp)
{
int searchFlags = 0;
if (regExp) searchFlags = SCFIND_REGEXP;
::SendScintilla(SCI_SEARCHANCHOR, 0,0);
return ::SendScintilla(SCI_SEARCHNEXT, searchFlags,(LPARAM)searchText);
}

int searchPrev(char* searchText, bool regExp)
sptr_t searchPrev(char* searchText, bool regExp)
{
int searchFlags = 0;
if (regExp) searchFlags = SCFIND_REGEXP;
Expand All @@ -126,7 +126,7 @@ int searchPrev(char* searchText, bool regExp)
}


unsigned int sciGetText(char **text, int start, int end)
sptr_t sciGetText(char **text, sptr_t start, sptr_t end)
{
if (start == -1)
{
Expand All @@ -143,7 +143,7 @@ unsigned int sciGetText(char **text, int start, int end)
tr.chrg.cpMin = start;
tr.chrg.cpMax = end;
tr.lpstrText = *text;
return (int)SendScintilla(SCI_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
return SendScintilla(SCI_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));
} else
{
strcpy(*text,"");
Expand Down
6 changes: 3 additions & 3 deletions NppApi/NppApiHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ int setCommand(TCHAR *cmdName = TEXT(""), PFUNCPLUGINCMD pFunc = NULL, ShortcutK
int showMessageBox(TCHAR* text = TEXT(""), int flags = MB_OK);

// Search in Scintilla
int searchNext(char* searchText, bool regExp = false);
int searchPrev(char* searchText, bool regExp = false);
sptr_t searchNext(char* searchText, bool regExp = false);
sptr_t searchPrev(char* searchText, bool regExp = false);

// Getting Text from Scintilla
unsigned int sciGetText(char **text, int start = -1, int end = -1);
sptr_t sciGetText(char **text, sptr_t start = -1, sptr_t end = -1);
//unsigned int sciGetText(HWND hwnd, char **text, int start, int end)

void closeTab(TCHAR* path);
Expand Down
Loading