nsxive7bc3bb
Non-working skeleton
+262 −0
10 files changed
- A Makefile +28 −0
- A app.c +21 −0
- A app.h +33 −0
- A config.h +11 −0
- A image.c +21 −0
- A image.h +37 −0
- A main.c +34 −0
- A sxiv.h +26 −0
- A window.c +21 −0
- A window.h +30 −0
| @@ -0,0 +1,28 @@ | |||
| 1 | + | all: sxiv | |
| 2 | + | ||
| 3 | + | CC?=gcc | |
| 4 | + | PREFIX?=/usr/local | |
| 5 | + | CFLAGS+= -Wall -pedantic -g | |
| 6 | + | LDFLAGS+= | |
| 7 | + | LIBS+= | |
| 8 | + | ||
| 9 | + | SRCFILES=$(wildcard *.c) | |
| 10 | + | OBJFILES=$(SRCFILES:.c=.o) | |
| 11 | + | ||
| 12 | + | physlock: $(OBJFILES) | |
| 13 | + | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | |
| 14 | + | ||
| 15 | + | %.o: %.c Makefile | |
| 16 | + | $(CC) $(CFLAGS) -c -o $@ $< | |
| 17 | + | ||
| 18 | + | install: all | |
| 19 | + | install -D -m 4755 -o root -g root sxiv $(PREFIX)/sbin/sxiv | |
| 20 | + | ||
| 21 | + | clean: | |
| 22 | + | rm -f sxiv *.o | |
| 23 | + | ||
| 24 | + | tags: *.h *.c | |
| 25 | + | ctags $^ | |
| 26 | + | ||
| 27 | + | cscope: *.h *.c | |
| 28 | + | cscope -b | |
| @@ -0,0 +1,21 @@ | |||
| 1 | + | /* sxiv: app.c | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #include "sxiv.h" | |
| 20 | + | #include "app.h" | |
| 21 | + | ||
| @@ -0,0 +1,33 @@ | |||
| 1 | + | /* sxiv: app.h | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #ifndef APP_H | |
| 20 | + | #define APP_H | |
| 21 | + | ||
| 22 | + | #include "image.h" | |
| 23 | + | #include "window.h" | |
| 24 | + | ||
| 25 | + | typedef struct app_s { | |
| 26 | + | const char **filenames; | |
| 27 | + | unsigned int filecnt; | |
| 28 | + | unsigned int fileidx; | |
| 29 | + | img_t img; | |
| 30 | + | win_t win; | |
| 31 | + | } app_t; | |
| 32 | + | ||
| 33 | + | #endif /* APP_H */ | |
| @@ -0,0 +1,11 @@ | |||
| 1 | + | /* */ | |
| 2 | + | #define WIN_WIDTH 800 | |
| 3 | + | #define WIN_HEIGHT 600 | |
| 4 | + | ||
| 5 | + | /* */ | |
| 6 | + | #define SCALE_MODE SCALE_DOWN | |
| 7 | + | ||
| 8 | + | /* */ | |
| 9 | + | #define ZOOM_MIN 12.5 | |
| 10 | + | #define ZOOM_MAX 400 | |
| 11 | + | ||
| @@ -0,0 +1,21 @@ | |||
| 1 | + | /* sxiv: image.c | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #include "sxiv.h" | |
| 20 | + | #include "image.h" | |
| 21 | + | ||
| @@ -0,0 +1,37 @@ | |||
| 1 | + | /* sxiv: image.h | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #ifndef IMAGE_H | |
| 20 | + | #define IMAGE_H | |
| 21 | + | ||
| 22 | + | typedef enum { | |
| 23 | + | SCALE_DOWN = 0; | |
| 24 | + | SCALE_FIT; | |
| 25 | + | SCALE_ZOOM; | |
| 26 | + | } scalemode_t; | |
| 27 | + | ||
| 28 | + | typedef struct img_s { | |
| 29 | + | scalemode_t scalemode; | |
| 30 | + | int zoom; | |
| 31 | + | int w; | |
| 32 | + | int h; | |
| 33 | + | int x; | |
| 34 | + | int y; | |
| 35 | + | } img_t; | |
| 36 | + | ||
| 37 | + | #endif /* IMAGE_H */ | |
| @@ -0,0 +1,34 @@ | |||
| 1 | + | /* sxiv: main.c | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #include "sxiv.h" | |
| 20 | + | #include "app.h" | |
| 21 | + | ||
| 22 | + | app_t app; | |
| 23 | + | ||
| 24 | + | void cleanup() { | |
| 25 | + | static int in = 0; | |
| 26 | + | ||
| 27 | + | if (!in++) { | |
| 28 | + | } | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | int main(int argc, char **argv) { | |
| 32 | + | ||
| 33 | + | return 0; | |
| 34 | + | } | |
| @@ -0,0 +1,26 @@ | |||
| 1 | + | /* sxiv: sxiv.h | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #ifndef SXIV_H | |
| 20 | + | #define SXIV_H | |
| 21 | + | ||
| 22 | + | #include "config.h" | |
| 23 | + | ||
| 24 | + | #define VERSION "git-20110117" | |
| 25 | + | ||
| 26 | + | #endif /* SXIV_H */ | |
| @@ -0,0 +1,21 @@ | |||
| 1 | + | /* sxiv: window.c | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #include "sxiv.h" | |
| 20 | + | #include "window.h" | |
| 21 | + | ||
| @@ -0,0 +1,30 @@ | |||
| 1 | + | /* sxiv: window.h | |
| 2 | + | * Copyright (c) 2011 Bert Muennich <muennich at informatik.hu-berlin.de> | |
| 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 2 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, write to the Free Software | |
| 16 | + | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | + | */ | |
| 18 | + | ||
| 19 | + | #ifndef WINDOW_H | |
| 20 | + | #define WINDOW_H | |
| 21 | + | ||
| 22 | + | typedef struct win_s { | |
| 23 | + | int w; | |
| 24 | + | int h; | |
| 25 | + | int x; | |
| 26 | + | int y; | |
| 27 | + | int bw; | |
| 28 | + | } win_t; | |
| 29 | + | ||
| 30 | + | #endif /* WINDOW_H */ | |