diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7026041 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Build outputs +ClassicNotepad.exe +notepad.exe +ClassicNotepad.res +ClassicNotepadSetup.exe + +# IDE artifacts +*.code-workspace +.vscode/ diff --git a/ClasicNotepad.c b/ClassicNotepad.c similarity index 97% rename from ClasicNotepad.c rename to ClassicNotepad.c index 2196cdf..af1b4e8 100644 --- a/ClasicNotepad.c +++ b/ClassicNotepad.c @@ -76,7 +76,7 @@ static void UpdateTitle(HWND hwnd) } WCHAR title[512]; - swprintf_s(title, ARRAYSIZE(title), L"%s - ClasicNotepad", name); + swprintf_s(title, ARRAYSIZE(title), L"%s - ClassicNotepad", name); SetWindowTextW(hwnd, title); } @@ -158,7 +158,7 @@ static HMENU BuildMenu(void) AppendMenuW(hFormat, MF_STRING, IDM_FORMAT_FONT, L"&Font..."); HMENU hHelp = CreatePopupMenu(); - AppendMenuW(hHelp, MF_STRING, IDM_HELP_ABOUT, L"&About ClasicNotepad"); + AppendMenuW(hHelp, MF_STRING, IDM_HELP_ABOUT, L"&About ClassicNotepad"); AppendMenuW(hMenu, MF_POPUP, (UINT_PTR)hFile, L"&File"); AppendMenuW(hMenu, MF_POPUP, (UINT_PTR)hEdit, L"&Edit"); @@ -428,7 +428,7 @@ static void ChooseFontAndApply(HWND hwnd) static void ShowAbout(HWND hwnd) { - MessageBoxW(hwnd, L"ClasicNotepad\nBuilt with Win32 API in C.", L"About", MB_OK | MB_ICONINFORMATION); + MessageBoxW(hwnd, L"ClassicNotepad\nBuilt with Win32 API in C.\ngithub.com/acidburnmonkey/ClassicNotepad", L"About", MB_OK | MB_ICONINFORMATION); } static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -552,7 +552,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd wc.hIcon = hIconLarge; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wc.lpszClassName = L"ClasicNotepadClass"; + wc.lpszClassName = L"ClassicNotepadClass"; wc.hIconSm = hIconSmall; if (!RegisterClassExW(&wc)) @@ -561,7 +561,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd return -1; } - HWND hwnd = CreateWindowExW(0, wc.lpszClassName, L"ClasicNotepad", WS_OVERLAPPEDWINDOW, + HWND hwnd = CreateWindowExW(0, wc.lpszClassName, L"ClassicNotepad", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL); if (!hwnd) diff --git a/ClassicNotepad.iss b/ClassicNotepad.iss new file mode 100644 index 0000000..870658b --- /dev/null +++ b/ClassicNotepad.iss @@ -0,0 +1,39 @@ +[Setup] +AppId={{B7CBF4E7-9E8F-4A5B-9B73-7B7E5D5D5E6A}} +AppName=ClassicNotepad +AppVersion=1.0.0 +AppPublisher=ClassicNotepad +DefaultDirName={autopf}\ClassicNotepad +DefaultGroupName=ClassicNotepad +OutputBaseFilename=ClassicNotepadSetup +SetupIconFile=app.ico +UninstallDisplayIcon={app}\ClassicNotepad.exe +ArchitecturesAllowed=x86 x64 +ArchitecturesInstallIn64BitMode=x64 +PrivilegesRequired=lowest +ChangesAssociations=yes + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "Create a &desktop icon"; Flags: unchecked +Name: "assoc"; Description: "Set ClassicNotepad as the default for .txt files"; Flags: unchecked + +[Files] +Source: "ClassicNotepad.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "notepad.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "app.ico"; DestDir: "{app}"; Flags: ignoreversion + +[Icons] +Name: "{autoprograms}\ClassicNotepad"; Filename: "{app}\ClassicNotepad.exe"; IconFilename: "{app}\app.ico" +Name: "{autoprograms}\Notepad (ClassicNotepad)"; Filename: "{app}\ClassicNotepad.exe"; IconFilename: "{app}\app.ico" +Name: "{autoprograms}\Notepad"; Filename: "{app}\notepad.exe"; IconFilename: "{app}\app.ico" +Name: "{autodesktop}\ClassicNotepad"; Filename: "{app}\ClassicNotepad.exe"; Tasks: desktopicon; IconFilename: "{app}\app.ico" + +[Registry] +; Associate .txt with ClassicNotepad (per-user) +Root: HKCU; Subkey: "Software\Classes\.txt"; ValueType: string; ValueName: ""; ValueData: "ClassicNotepad.txt"; Tasks: assoc; Flags: uninsdeletevalue +Root: HKCU; Subkey: "Software\Classes\ClassicNotepad.txt"; ValueType: string; ValueData: "Text Document"; Tasks: assoc; Flags: uninsdeletekey +Root: HKCU; Subkey: "Software\Classes\ClassicNotepad.txt\DefaultIcon"; ValueType: string; ValueData: "{app}\ClassicNotepad.exe,0"; Tasks: assoc; Flags: uninsdeletekey +Root: HKCU; Subkey: "Software\Classes\ClassicNotepad.txt\shell\open\command"; ValueType: string; ValueData: """{app}\ClassicNotepad.exe"" ""%1"""; Tasks: assoc; Flags: uninsdeletekey diff --git a/ClassicNotepad.rc b/ClassicNotepad.rc new file mode 100644 index 0000000..d725649 --- /dev/null +++ b/ClassicNotepad.rc @@ -0,0 +1,3 @@ +#include + +IDI_APP ICON "app.ico" diff --git a/Makefile b/Makefile index 95cf6b3..c12a553 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,16 @@ +SHELL = cmd +.SHELLFLAGS = /C + CC = gcc WINDRES = windres -TARGET = ClasicNotepad.exe -SRC = ClasicNotepad.c -RES = ClasicNotepad.res +TARGET = ClassicNotepad.exe +SRC = ClassicNotepad.c +RES = ClassicNotepad.res +ALIAS = notepad.exe +ISCC = iscc +INSTALLER = ClassicNotepadSetup.exe +CP = copy /y +RM = del /f /q CFLAGS = -Wall -Wextra -std=c11 -mwindows LDLIBS = -luser32 -lgdi32 -lcomdlg32 @@ -10,9 +18,19 @@ LDLIBS = -luser32 -lgdi32 -lcomdlg32 $(TARGET): $(SRC) $(RES) $(CC) $(CFLAGS) -o $@ $(SRC) $(RES) $(LDLIBS) -$(RES): ClasicNotepad.rc app.ico - $(WINDRES) -O coff ClasicNotepad.rc $(RES) +$(ALIAS): $(TARGET) + $(CP) $(TARGET) $(ALIAS) >NUL + +$(RES): ClassicNotepad.rc app.ico + $(WINDRES) -O coff ClassicNotepad.rc $(RES) + +.PHONY: all clean install +all: $(TARGET) $(ALIAS) + +install: $(INSTALLER) + +$(INSTALLER): ClassicNotepad.iss $(TARGET) $(ALIAS) app.ico + $(ISCC) ClassicNotepad.iss -.PHONY: clean clean: - del /f /q $(TARGET) $(RES) 2>NUL || true + -$(RM) $(TARGET) $(RES) $(ALIAS) $(INSTALLER) 2>NUL diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa9a343 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# ClassicNotepad + +Lightweight Win32 notepad-like editor with word wrap toggle, font picker, and custom icon. + +## Build +Prereqs: MinGW toolchain on PATH (`gcc`, `windres`, `mingw32-make`). + +```bash +mingw32-make all +``` + +Outputs: +- `ClassicNotepad.exe` — main executable +- `notepad.exe` — alias for quick search + +Clean build artifacts: + +```bash +mingw32-make clean +``` + +## Run +Launch `ClassicNotepad.exe` (or `notepad.exe`) from the build directory.