This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 75d8ed70740c7f15606f382a4bba5cd14a632b24 (commit) via b2d6a3f08090bcd31e6e648b6a56204b31d89670 (commit) via 0b961e5fe009d0773836956507226444119eb0ec (commit) from 5a09bd55e0ab64565d12d30ef583d9572d66d6be (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/75d8ed70740c7f15606f382a4bba5cd14a632...
commit 75d8ed70740c7f15606f382a4bba5cd14a632b24 Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 21 00:47:04 2012 +0100
demos: spiv: Add help screen.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 25a7d85..cbb77a0 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -577,8 +577,51 @@ static void resize_backend(struct loader_params *params, float ratio, int shift_ GP_BackendResize(backend, w, h); }
+static const char *keys_help[] = { + "Keyboard control:", + "", + "I - toggle show info box", + "P - toggle show progress", + "R - rotate by 90 degrees", + "] - change to next resampling method", + "[ - change to prev resampling method", + " (current method is shown in info box)", + "L - toggle low pass filter", + "D - drop image cache", + "H - toggle help", + "", + "Esc", + "Enter", + "Q - quit spiv", + "", + "PgDown - move ten image forward", + "PgUp - move ten image backward", + "", + "Right", + "Up", + "Space - move to the next image", + "", + "Left", + "Down", + "BckSpc - move to the prev image", + "", + "1 - resize spiv window to the image size", + "2 - resize spiv window to the half of the image size", + "3 - resize spiv window to the third of the image size", + "...", + "9 - resize spiv window to the ninth of the image size", + "", + "Shift 2 - resize spiv window twice of the image size", + "Shift 3 - resize spiv window three times of the image size", + "...", +}; + +static const int keys_help_len = sizeof(keys_help) / sizeof(char*); + static void print_help(void) { + int i; + printf("Usage: spiv [opts] imagesnn"); printf("-Intshow image info (filename and size)nn"); printf("-Pntshow loading progressnn"); @@ -592,36 +635,10 @@ static void print_help(void) printf("-bntpass backend init string to backend initn"); printf("tpass -b help for more infonn");
- printf("Keyboard control:nn"); - printf("I - toggle show infon"); - printf("P - toggle show progressn"); - printf("R - rotate by 90 degreesn"); - printf("] - change to next resampling methodn"); - printf("[ - change to prev resampling methodn"); - printf(" (current method is shown in infon"); - printf("L - toggle low pass filtern"); - printf("D - drop image cachen"); - printf("nEscn"); - printf("Entern"); - printf("Q - quit spivnn"); - printf("PgDown - move ten image forwardn"); - printf("PgUp - move ten image backwardn"); - printf("nRightn"); - printf("Upn"); - printf("Space - move to the next imagen"); - printf("nLeftn"); - printf("Downn"); - printf("BckSpc - move to the prev imagen"); - printf("n"); - printf("1 - resize spiv window to the image sizen"); - printf("2 - resize spiv window to the half of the image sizen"); - printf("3 - resize spiv window to the third of the image sizen"); - printf("...n"); - printf("9 - resize spiv window to the ninth of the image sizen"); - printf("n"); - printf("Shift 2 - resize spiv window twice of the image sizen"); - printf("Shift 3 - resize spiv window three times of the image sizen"); - printf("...nn"); + for (i = 0; i < keys_help_len; i++) + puts(keys_help[i]); + + puts("");
printf("Some cool options to try:nn"); printf("spiv -e G1 -f imagesn"); @@ -633,13 +650,28 @@ static void print_help(void)
}
+static void show_help(void) +{ + GP_Context *c = backend->context; + int i; + + GP_Fill(c, black_pixel); + + for (i = 0; i < keys_help_len; i++) { + GP_Print(c, NULL, 20, i * 15, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + white_pixel, black_pixel, "%s", keys_help[i]); + } + + GP_BackendFlip(backend); +} + int main(int argc, char *argv[]) { GP_Context *context = NULL; const char *backend_opts = "X11"; int sleep_sec = -1; int opt, debug_level = 0; - int shift_flag; + int shift_flag, help_flag = 0; GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
struct loader_params params = { @@ -749,12 +781,10 @@ int main(int argc, char *argv[]) GP_Event ev;
while (GP_EventGet(&ev)) { - - GP_EventDump(&ev); - + shift_flag = GP_EventGetKey(&ev, GP_KEY_LEFT_SHIFT) || GP_EventGetKey(&ev, GP_KEY_RIGHT_SHIFT); - + switch (ev.type) { case GP_EV_REL: switch (ev.code) { @@ -772,6 +802,15 @@ int main(int argc, char *argv[]) continue;
switch (ev.val.key.key) { + case GP_KEY_H: + if (help_flag) + show_image(¶ms, NULL); + else + show_help(); + + //TODO: remove help_flag on any other action done + help_flag = !help_flag; + break; case GP_KEY_F: if (GP_BackendIsX11(backend)) GP_BackendX11RequestFullscreen(backend, 2);
http://repo.or.cz/w/gfxprim.git/commit/b2d6a3f08090bcd31e6e648b6a56204b31d89...
commit b2d6a3f08090bcd31e6e648b6a56204b31d89670 Merge: 0b961e5 5a09bd5 Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 21 00:26:05 2012 +0100
Merge ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/0b961e5fe009d0773836956507226444119eb...
commit 0b961e5fe009d0773836956507226444119eb0ec Author: Cyril Hrubis metan@ucw.cz Date: Fri Dec 21 00:16:54 2012 +0100
demos: spiv: Fix crash on empty dir, edhance err message.
diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c index 8ed726a..1376130 100644 --- a/demos/spiv/image_list.c +++ b/demos/spiv/image_list.c @@ -64,9 +64,11 @@ static int dir_filter(const struct dirent *d) if (!strcmp(d->d_name, "..")) return 0; + //TODO: filter out directories, non-image files? + + GP_DEBUG(4, "Adding file '%s'", d->d_name); - return 1; }
@@ -87,11 +89,16 @@ static void try_load_dir(struct image_list *self)
int ret = scandir(path, &self->dir_files, dir_filter, dir_cmp);
- if (self->max_file == -1) { + if (ret == -1) { GP_WARN("Failed to scandir '%s': %s", path, strerror(errno)); return; }
+ if (ret == 0) { + GP_DEBUG(1, "There are no files in '%s'", path); + return; + } + self->max_file = ret; self->cur_file = 0; self->in_dir = 1; diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 82a8e75..25a7d85 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -163,7 +163,10 @@ GP_Context *load_image(struct loader_params *params, int elevate) return NULL;
GP_Fill(context, black_pixel); - GP_Print(context, NULL, context->w/2, context->h/2, + GP_Print(context, NULL, context->w/2, context->h/2 - 10, + GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, + "'%s'", params->img_path); + GP_Print(context, NULL, context->w/2, context->h/2 + 10, GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "Failed to load image :( (%s)", strerror(errno)); GP_BackendFlip(backend);
-----------------------------------------------------------------------
Summary of changes: demos/spiv/image_list.c | 11 ++++- demos/spiv/spiv.c | 114 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 87 insertions(+), 38 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.