diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | c/main.cpp | 18 | ||||
-rw-r--r-- | showtodo | 27 |
3 files changed, 42 insertions, 13 deletions
@@ -10,6 +10,9 @@ CLFLAGS += -Wall -Wextra -Wpedantic -Wno-missing-field-initializers -Wno-parenth CLFLAGS += -ld-options,-mwindows,-static-libstdc++ -lcomctl32 #CLFLAGS += -ld-options,-mconsole +WINI = C:/Perl/c/x86_64-w64-mingw32/include +WINH = $(WINI)/win*.h $(WINI)/basetsd.h + all: showdeps b/$(EXE) cp b/$(EXE) "C:\Users\John\Desktop\Delat" @@ -17,7 +20,7 @@ clean: rm -fr b/$(EXE) b/*.obj TAGS: c/*.cpp c/*.h pl/*.pl - etags c/*.cpp c/*.h -lprolog pl/*.pl + etags c/*.cpp c/*.h $(WINH) -lprolog pl/*.pl b/$(EXE): Makefile c/main.cpp $(OBJ) $(PL) $(CL) $(CLFLAGS) -goal true -o $@ c/main.cpp $(OBJ) $(PL) @@ -38,6 +41,11 @@ s/%.s: c/%.cpp showdeps: @perl showdeps +# showdeps prints all TODO comments in the C++ source files. +.PHONY: showtodo +showtodo: + @perl showtodo + # deps.mk includes additional, dynamically generated dependencies for # b/*.obj and b/EpisodeBrowser.exe. Because it is included below, GNU # make should build deps.mk automatically. @@ -258,20 +258,12 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, break; case 0x02E0: /* WM_DPICHANGED */ { - const RECT* const r = reinterpret_cast<RECT*>(lParam); - - /* Update DPI and cached metrics. */ - g_dpi = HIWORD(wParam); - Metric<SM_CXVSCROLL> = GetSystemMetrics(SM_CXVSCROLL); - Metric<SM_CXDOUBLECLK> = GetSystemMetrics(SM_CXDOUBLECLK); - Metric<SM_CYDOUBLECLK> = GetSystemMetrics(SM_CYDOUBLECLK); - /* TODO: What does GetSystemMetrics return depending - * on the DPI? The documentation says it is not - * DPI-aware. Does that mean that Dpi( - * GetSystemMetrics(...)) will give the correct value? - * If so, the cached values need not be updated. */ + * on the DPI? Do the cached values need to be updated + * when the DPI changes? */ + g_dpi = HIWORD(wParam); + const RECT* const r = reinterpret_cast<RECT*>(lParam); Prefer(SetWindowPos(hWnd, nullptr, r->left, r->top, r->right-r->left, @@ -410,6 +402,8 @@ void HandleMainMenu(const HWND hWnd, const WORD command) Pl("cfg","set_view_watched",g_bViewWatched); g_elv->Update(); g_elv->EnsureFocusVisible(); + /* TODO: Remember last valid focus. In case of + * non-existing focus, use the last valid focus. */ break; case IDM_VIEW_TV_ORIGINAL: CheckMenuItem(GetMenu(hWnd), IDM_VIEW_TV_ORIGINAL, g_bViewTVOriginal? MF_UNCHECKED: MF_CHECKED); diff --git a/showtodo b/showtodo new file mode 100644 index 0000000..475e492 --- /dev/null +++ b/showtodo @@ -0,0 +1,27 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +# Note that this script only supports /* C-style */ comments. + +while (my $f = glob("c/*.*")) { + open my $fh, "<", $f; + my $line; + while (<$fh>) { + $line++; + next if not m{TODO:}; # Skip fast. + + next if not m{^\s*/?\*.*\s(TODO:.*)\s*(\*/)?}; + print "$f:$line: $1\n"; + next if $2; + + # Continue text if comment is not finished. + my $pad = " " x length("$f:$line: "); + while (<$fh>) { + (my $text = $_) =~ s{^\s*\*?\s*|\s*\*/}{}g; + print "$pad$text"; + last if m{\*/}; + } + } +} |