Skip to content

Commit 2b538ed

Browse files
authored
Merge pull request #1 from iTrace-Dev/develop
Create first release of iTrace-NotepadPlusPlus
2 parents 52e4ea3 + 24df53d commit 2b538ed

23 files changed

+5954
-1
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
bin/
2+
bin64/
3+
arm64/
4+
vs.proj/Debug
5+
vs.proj/Release
6+
vs.proj/.vs
7+
vs.proj/iTrace-NPP
8+
vs.proj/x64
9+
vs.proj/ARM64
10+
vs.proj/iTrace-NPP.opensdf
11+
vs.proj/iTrace-NPP.sdf
12+
*.suo
13+
*.sln
14+
vs.proj/iTrace-NPP.exp
15+
vs.proj/iTrace-NPP.lib
16+
*.aps
17+
vs.proj/iTrace-NPP.vcxproj.user
18+
*.zip
19+
*.bak

LICENSE.md

Lines changed: 675 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
11
# iTrace-NotepadPlusPlus
2-
Notepad++ plugin to identify textual and interface elements based on iTrace Core gaze data
2+
iTrace-NotepadPlusPlus (or iTrace-Notepad++) is a plugin for the Notepad++ Text Editor. The plugin will establish a connection to the [iTrace-Core](https://github.com/iTrace-Dev/iTrace-Core) desktop application. Once connected to the Core, the plugin will accept eye-tracking information from the Core and translate it to editor-specific data and output said data to an XML file.
3+
4+
# Installation
5+
1. Download the latest version of the plugin. It will be a .dll file.
6+
2. Open Notepad++, and select Plugins->Open Plugins Folder...
7+
3. Create a folder for the plugin. The folder must be named the same as the .dll file. By default, the folder should be named `iTrace-NPP`.
8+
4. Drag and drop the .dll file in the folder.
9+
5. Restart Notepad++. The plugin should now be installed.
10+
11+
# Usage
12+
To use iTrace-Notepad++, make sure you have iTrace-Core installed.
13+
1. Open any files you wish to view in Notepad++.
14+
2. Run iTrace-Core and set up the parameters of your tracking session.
15+
3. Select Plugins->iTrace-NPP->Connect to iTrace Core. Alternatively, press `Alt+I`.
16+
4. iTrace-Notepad++ should not be connected to iTrace-Core. A notification should appear in the bottom left notifying you of any errors in connecting.
17+
5. Once a tracking session is started, iTrace-Notepad++ will begin writing to a file in the location specified in iTrace-Core. When the tracking session is finished, two files will be present - one from iTrace-Notepad++ and the other from iTrace-Core.
18+
19+
# How to Build From Source
20+
If you want to build the plugin from source, follow these steps:
21+
1. Download or clone the source code.
22+
2. Open `/vs.proj/iTrace-NPP.vcxproj` using Visual Studio 2022.
23+
3. The code should now be open in Visual Studio.
24+
4. To build the .dll file, select Build->Build Solution. The .dll will be created in `/vs.proj/x64/Debug/`.
25+
26+
# Further Steps
27+
After gathering your data, you can use our other tools [iTrace-Toolkit](https://github.com/iTrace-Dev/iTrace-Toolkit) and [iTrace-Visualize](https://github.com/iTrace-Dev/iTrace-Visualize) to analyze and process the tracking sessions.

src/DockingFeature/Docking.h

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// This file is part of Notepad++ project
2+
// Copyright (C)2022 Don HO <[email protected]>
3+
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// at your option any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
18+
#pragma once
19+
20+
#include <windows.h>
21+
22+
// ATTENTION : It's a part of interface header, so don't include the others header here
23+
24+
// styles for containers
25+
#define CAPTION_TOP TRUE
26+
#define CAPTION_BOTTOM FALSE
27+
28+
// defines for docking manager
29+
#define CONT_LEFT 0
30+
#define CONT_RIGHT 1
31+
#define CONT_TOP 2
32+
#define CONT_BOTTOM 3
33+
#define DOCKCONT_MAX 4
34+
35+
// mask params for plugins of internal dialogs
36+
#define DWS_ICONTAB 0x00000001 // Icon for tabs are available
37+
#define DWS_ICONBAR 0x00000002 // Icon for icon bar are available (currently not supported)
38+
#define DWS_ADDINFO 0x00000004 // Additional information are in use
39+
#define DWS_PARAMSALL (DWS_ICONTAB|DWS_ICONBAR|DWS_ADDINFO)
40+
41+
// default docking values for first call of plugin
42+
#define DWS_DF_CONT_LEFT (CONT_LEFT << 28) // default docking on left
43+
#define DWS_DF_CONT_RIGHT (CONT_RIGHT << 28) // default docking on right
44+
#define DWS_DF_CONT_TOP (CONT_TOP << 28) // default docking on top
45+
#define DWS_DF_CONT_BOTTOM (CONT_BOTTOM << 28) // default docking on bottom
46+
#define DWS_DF_FLOATING 0x80000000 // default state is floating
47+
48+
49+
typedef struct {
50+
HWND hClient; // client Window Handle
51+
const TCHAR *pszName; // name of plugin (shown in window)
52+
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
53+
54+
// user modifications
55+
UINT uMask; // mask params: look to above defines
56+
HICON hIconTab; // icon for tabs
57+
const TCHAR *pszAddInfo; // for plugin to display additional informations
58+
59+
// internal data, do not use !!!
60+
RECT rcFloat; // floating position
61+
int iPrevCont; // stores the privious container (toggling between float and dock)
62+
const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin
63+
} tTbData;
64+
65+
66+
typedef struct {
67+
HWND hWnd; // the docking manager wnd
68+
RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs
69+
} tDockMgr;
70+
71+
72+
#define HIT_TEST_THICKNESS 20
73+
#define SPLITTER_WIDTH 4
74+
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// This file is part of Notepad++ project
2+
// Copyright (C)2006 Jens Lorenz <[email protected]>
3+
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// at your option any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
18+
#pragma once
19+
20+
#include "dockingResource.h"
21+
#include "Docking.h"
22+
23+
#include <assert.h>
24+
#include <shlwapi.h>
25+
#include <string>
26+
#include "StaticDialog.h"
27+
28+
29+
30+
class DockingDlgInterface : public StaticDialog
31+
{
32+
public:
33+
DockingDlgInterface() = default;
34+
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}
35+
36+
virtual void init(HINSTANCE hInst, HWND parent) {
37+
StaticDialog::init(hInst, parent);
38+
TCHAR temp[MAX_PATH];
39+
::GetModuleFileName(reinterpret_cast<HMODULE>(hInst), temp, MAX_PATH);
40+
_moduleName = ::PathFindFileName(temp);
41+
}
42+
43+
void create(tTbData* data, bool isRTL = false) {
44+
assert(data != nullptr);
45+
StaticDialog::create(_dlgID, isRTL);
46+
TCHAR temp[MAX_PATH];
47+
::GetWindowText(_hSelf, temp, MAX_PATH);
48+
_pluginName = temp;
49+
50+
// user information
51+
data->hClient = _hSelf;
52+
data->pszName = _pluginName.c_str();
53+
54+
// supported features by plugin
55+
data->uMask = 0;
56+
57+
// additional info
58+
data->pszAddInfo = NULL;
59+
}
60+
61+
virtual void updateDockingDlg() {
62+
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
63+
}
64+
65+
virtual void destroy() {}
66+
67+
virtual void setBackgroundColor(COLORREF) {}
68+
virtual void setForegroundColor(COLORREF) {}
69+
70+
virtual void display(bool toShow = true) const {
71+
::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
72+
}
73+
74+
bool isClosed() const {
75+
return _isClosed;
76+
}
77+
78+
void setClosed(bool toClose) {
79+
_isClosed = toClose;
80+
}
81+
82+
const TCHAR * getPluginFileName() const {
83+
return _moduleName.c_str();
84+
}
85+
86+
protected :
87+
int _dlgID = -1;
88+
bool _isFloating = true;
89+
int _iDockedPos = 0;
90+
std::wstring _moduleName;
91+
std::wstring _pluginName;
92+
bool _isClosed = false;
93+
94+
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam) {
95+
switch (message)
96+
{
97+
case WM_NOTIFY:
98+
{
99+
LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);
100+
101+
if (pnmh->hwndFrom == _hParent)
102+
{
103+
switch (LOWORD(pnmh->code))
104+
{
105+
case DMN_CLOSE:
106+
{
107+
break;
108+
}
109+
case DMN_FLOAT:
110+
{
111+
_isFloating = true;
112+
break;
113+
}
114+
case DMN_DOCK:
115+
{
116+
_iDockedPos = HIWORD(pnmh->code);
117+
_isFloating = false;
118+
break;
119+
}
120+
default:
121+
break;
122+
}
123+
}
124+
break;
125+
}
126+
default:
127+
break;
128+
}
129+
return FALSE;
130+
};
131+
};

src/DockingFeature/GoToLineDlg.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//this file is part of notepad++
2+
//Copyright (C)2022 Don HO <[email protected]>
3+
//
4+
//This program is free software; you can redistribute it and/or
5+
//modify it under the terms of the GNU General Public License
6+
//as published by the Free Software Foundation; either
7+
//version 2 of the License, or (at your option) any later version.
8+
//
9+
//This program is distributed in the hope that it will be useful,
10+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
//GNU General Public License for more details.
13+
//
14+
//You should have received a copy of the GNU General Public License
15+
//along with this program; if not, write to the Free Software
16+
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17+
18+
#include "GoToLineDlg.h"
19+
#include "../PluginDefinition.h"
20+
21+
extern NppData nppData;
22+
23+
INT_PTR CALLBACK DemoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
24+
{
25+
switch (message)
26+
{
27+
case WM_COMMAND :
28+
{
29+
switch (wParam)
30+
{
31+
case IDOK :
32+
{
33+
int line = getLine();
34+
if (line != -1)
35+
{
36+
// Get the current scintilla
37+
int which = -1;
38+
::SendMessage(nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&which);
39+
if (which == -1)
40+
return FALSE;
41+
HWND curScintilla = (which == 0)?nppData._scintillaMainHandle:nppData._scintillaSecondHandle;
42+
43+
::SendMessage(curScintilla, SCI_ENSUREVISIBLE, line-1, 0);
44+
::SendMessage(curScintilla, SCI_GOTOLINE, line-1, 0);
45+
}
46+
return TRUE;
47+
}
48+
}
49+
return FALSE;
50+
}
51+
52+
default :
53+
return DockingDlgInterface::run_dlgProc(message, wParam, lParam);
54+
}
55+
}
56+

src/DockingFeature/GoToLineDlg.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//this file is part of notepad++
2+
//Copyright (C)2022 Don HO <[email protected]>
3+
//
4+
//This program is free software; you can redistribute it and/or
5+
//modify it under the terms of the GNU General Public License
6+
//as published by the Free Software Foundation; either
7+
//version 2 of the License, or (at your option) any later version.
8+
//
9+
//This program is distributed in the hope that it will be useful,
10+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
//GNU General Public License for more details.
13+
//
14+
//You should have received a copy of the GNU General Public License
15+
//along with this program; if not, write to the Free Software
16+
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17+
18+
#ifndef GOTILINE_DLG_H
19+
#define GOTILINE_DLG_H
20+
21+
#include "DockingDlgInterface.h"
22+
#include "resource.h"
23+
24+
class DemoDlg : public DockingDlgInterface
25+
{
26+
public :
27+
DemoDlg() : DockingDlgInterface(IDD_PLUGINGOLINE_DEMO){};
28+
29+
virtual void display(bool toShow = true) const {
30+
DockingDlgInterface::display(toShow);
31+
if (toShow)
32+
::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
33+
};
34+
35+
void setParent(HWND parent2set){
36+
_hParent = parent2set;
37+
};
38+
39+
protected :
40+
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
41+
42+
private :
43+
44+
int getLine() const {
45+
BOOL isSuccessful;
46+
int line = ::GetDlgItemInt(_hSelf, ID_GOLINE_EDIT, &isSuccessful, FALSE);
47+
return (isSuccessful?line:-1);
48+
};
49+
50+
};
51+
52+
#endif //GOTILINE_DLG_H

0 commit comments

Comments
 (0)