Mon Oct 31 11:36:50 GMT 1999
(gilbertt) Added E-ScreenShoot This should make it easier to keep up to date :-) Enjoy. SVN revision: 1070
|
@ -1,3 +1,10 @@
|
|||
Mon Oct 31 11:36:50 GMT 1999
|
||||
(gilbertt)
|
||||
|
||||
Added E-ScreenShoot
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Mon Oct 18 16:02:50 PDT 1999
|
||||
(Mandrake)
|
||||
|
||||
|
|
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,319 @@
|
|||
<page columns=1 padding=16 name=front background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/32 color=#ffffff>
|
||||
<p align=50%>
|
||||
E-ScreenShoot
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
An Enlightenment Screenshot Grabber.
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p align=50%>
|
||||
By Tom Gilbert - 1999
|
||||
<p>
|
||||
This epplet takes screenshots. You'll need to have ImageMagick installed for
|
||||
anything to happen ;)
|
||||
<p>
|
||||
o _Control_Overview(overview)<br>
|
||||
o _Cloaking(cloaking)<br>
|
||||
o _What_Do_All_These_Buttons_Do???(buttons)<br>
|
||||
o _Config_File_Options(config)<br>
|
||||
o _Cloaking(cloaking)<br>
|
||||
o _Misc_Info(misc)<br>
|
||||
<p>
|
||||
Tom Gilbert (gilbertt@tomgilbert.freeserve.co.uk)
|
||||
|
||||
<page columns=1 padding=16 name=overview background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/16 color=#88eeff>
|
||||
<p align=50%>
|
||||
Control Overview
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<img src=E_ScreenShoot_buttons.png x=100 y=70>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=cloaking background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/16 color=#88eeff>
|
||||
<p align=50%>
|
||||
Cloaking
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<img src=E_ScreenShoot_cloak.png x=80 y=290>
|
||||
<p>
|
||||
I couldn't just write a screenshot grabber. It had to do something.... Else.
|
||||
<p>
|
||||
Cloaking is it. Like it or loathe it, I think it rules!
|
||||
<p>
|
||||
Benefits:<br>
|
||||
o Hides the ugly squashed-in buttons<br>
|
||||
o Looks nice<br>
|
||||
o Makes you screenshots prettier<br>
|
||||
o Multiple instance identification. Set up two instances, one grabbing to
|
||||
your home directory as a png, and one grabbing to a web resource, using 60%
|
||||
jpg compression. Set a different cloak-animation on each, and you'll be able
|
||||
to tell them apart ;-)
|
||||
<p>
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=buttons background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/16 color=#88eeff>
|
||||
<p align=50%>
|
||||
What do all these buttons do?
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
Ok, so you are confronted with quite a few buttons, and a slider.
|
||||
<p>
|
||||
The first two buttons should be obvious. You pressed one of them to get this
|
||||
help ;-)
|
||||
<p>
|
||||
The slider controls the compression quality of your screenshot.
|
||||
High (upwards) means high quality, high file size, low vice versa. This
|
||||
option only effects jpg, png and miff output.
|
||||
<p>
|
||||
The config button in the top-right changes the cloak-mode of the epplet.
|
||||
This is kind of like a 48x48 screensaver for an epplet, and covers up all
|
||||
those crammed-in buttons with some eye-candy. Experiment with the various
|
||||
modes to see which ones you like.
|
||||
<p>
|
||||
_There's_more,_click_here_to_continue(buttons2)
|
||||
|
||||
<page columns=1 padding=16 name=buttons2 background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/16 color=#88eeff>
|
||||
<p align=50%>
|
||||
What do all these buttons do? (2nd Row)
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
The leftmost button on the second row toggles root/window mode. In root
|
||||
mode (the default), the button is not depressed. When you take a screenshot
|
||||
in this mode, the entire desktop will be captured. When in window mode
|
||||
(button depressed), you will get a crosshair cursor. Either click on a
|
||||
window with this cursor to capture only that window, or click and drag a
|
||||
recangular area to grab that instead.
|
||||
<p>
|
||||
The middle button on the second row allows you to select the cloak timeout.
|
||||
This is the delay before the epplet cloak appears.
|
||||
<p>
|
||||
The rightmost button on the second row is the screenshot delay. Use this to
|
||||
configure a delay between pressing the button, and having the shot taken. A
|
||||
short delay is useful for arranging some windows or refocusing.
|
||||
<p>
|
||||
_There's_more,_click_here_to_continue(buttons3)
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=buttons3 background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/16 color=#88eeff>
|
||||
<p align=50%>
|
||||
What do all these buttons do? (3rd Row)
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
The left-hand button on the bottom row is used to change the colour of the
|
||||
RasterFire clock-animation (whose intensity is proprtional to screenshot
|
||||
quality btw). In a future version, this popup will change the colours used
|
||||
for all cloak_animations.
|
||||
<p>
|
||||
The bottom-right button is used to take the screenshot! Use it when you're
|
||||
happy with all the options, and want to start shootin'
|
||||
<p>
|
||||
_Config_File_Options(config)<br>
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=config background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Configuration File Options
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
Once the epplet has been run once, a configuration file will be created in
|
||||
~/enlightenment/epplet_configs/E-ScreenShooter/E-ScreenShooter.cfg
|
||||
<p>
|
||||
You may edit this file to fine-tune your screenshooting options.
|
||||
<p>
|
||||
_Example_File(confile)<br>
|
||||
_Interface_Options(intopt)<br>
|
||||
_Screen-shot_Options(shotopt)<br>
|
||||
|
||||
<page columns=1 padding=16 name=confile background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Example Configuration File
|
||||
<font face=aircut3/12 color=#112222>
|
||||
<p>
|
||||
### Automatically generated Epplet config file for E-ScreenShoot.
|
||||
<br>
|
||||
QUALITY 75
|
||||
<br>
|
||||
WIN_AREA 0
|
||||
<br>
|
||||
WM_FRAME 1
|
||||
<br>
|
||||
DO_CLOAK 1
|
||||
<br>
|
||||
BEEP 1
|
||||
<br>
|
||||
CLOAK_ANIM 1
|
||||
<br>
|
||||
SHOT_DELAY 0.0
|
||||
<br>
|
||||
CLOAK_DELAY 4.0
|
||||
<br>
|
||||
DRAW_INTERVAL 0.1
|
||||
<br>
|
||||
DIRECTORY ~/
|
||||
<br>
|
||||
FILE_PREFIX shot_
|
||||
<br>
|
||||
FILE_STAMP `date +%d-%m-%y_%H%M%S`
|
||||
<br>
|
||||
FILE_TYPE jpg
|
||||
<p>
|
||||
_Interface_Options(intopt)<br>
|
||||
_Screen-shot_Options(shotopt)<br>
|
||||
|
||||
<page columns=1 padding=16 name=intopt background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Interface Configuration File Options
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
DO_CLOAK 1
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
BOOLEAN 0/1: This option determines whether the applet is ever cloaked. 1
|
||||
mean yes, 0 means no.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
CLOAK_ANIM 1
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
NUMERIC INTEGER: This determines which cloak animation to use. Don't fiddle
|
||||
with this in the config, as you can do so using the popup menu.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
CLOAK_DELAY 4.0
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
NUMERIC FLOAT: This determines the time interval before the epplet is cloaked. Again, this
|
||||
can be changed using a popup on the epplet.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
DRAW_INTERVAL 0.1
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
NUMERIC FLOAT: This is the frequency of cloak-animation draws. A low value
|
||||
means lots of draws, a high value means jerky, slow updates. All the
|
||||
animations are tuned to work best for a value of 0.1, but you have the
|
||||
option to change it if the mood takes you.
|
||||
<p>
|
||||
_Screen-shot_Options(shotopt)<br>
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=shotopt background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Screen-Shot Configuration File Options
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
BEEP 1
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
BOOLEAN 0/1: This determines whether you hear a beep just before, and just
|
||||
after the screen-shot is taken. If 1, you will get audio feedback, if 0,
|
||||
things'll be quiet.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
QUALITY 75
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
NUMERIC INT 1-100: Screenshot quality, as a percentage. 100 is full quality,
|
||||
large filesize. This option applies only to jpg, png and miff image files.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
WIN_AREA 0
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
BOOLEAN 0/1: This is configurable from a button on the epplet. If 1, a
|
||||
window or rectangular area will be grabbed, if 0, the whole desktop.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
WM_FRAME 1
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
BOOLEAN 0/1: If you are grabbing single windows, do you also want the window
|
||||
manager decorations? 1 means yes, 0 means no. Does not effect
|
||||
entire-desktop shots.
|
||||
<p>
|
||||
_More_Screen-Shot_Options(shotopt2)
|
||||
|
||||
<page columns=1 padding=16 name=shotopt2 background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Screen-Shot Configuration File Options
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
SHOT_DELAY 0.0
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
NUMERIC FLOAT: Delay before taking shot. Can be altered using epplet popup.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
DIRECTORY ~/
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
STRING: Directory in which to save images. Can include shell variable or
|
||||
command substitution. You must be able to write to this directory.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
FILE_PREFIX shot_
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
STRING: Bit to stick on the front of the filename.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
FILE_STAMP `date +%d-%m-%y_%H%M%S`
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
STRING: Middle bit of filename. I recommend the use of something similar to
|
||||
the above. This is command substitution, and uses the date program to give
|
||||
the shot a unique name.
|
||||
<br>
|
||||
<font face=aircut3/12 color=#112222>
|
||||
FILE_TYPE jpg
|
||||
<br>
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
STRING: File extension. This also determines the file type. For a list of
|
||||
possible filetypes, see man convert(1). It'll do almost any filetype you can
|
||||
think of. I recommend jpg, png, or html (yes html - try it and see!)
|
||||
<p>
|
||||
_Misc_Info(misc)<br>
|
||||
|
||||
|
||||
<page columns=1 padding=16 name=misc background=bg.png linkcolor=#88dddd>
|
||||
<font face=aircut3/18 color=#88eeff>
|
||||
<p align=50%>
|
||||
Miscellaneous details
|
||||
<font face=aircut3/12 color=#ffffff>
|
||||
<p>
|
||||
I like eyecandy. Not everyone does, so feel free to turn off the cloaking
|
||||
stuff.
|
||||
<p>
|
||||
Before you do so however, please do not worry about cpu usage. I have tuned
|
||||
my drawing code lots, and its fairly clean. To prevent my epplet hogging
|
||||
cpu, I have explicitly re-prioritised it to the equivalent of a NICE value
|
||||
of 10. This means cpu will only be used if there is cpu available.
|
||||
<p>
|
||||
There are lots more options in the pipeline, among them are:
|
||||
<br>
|
||||
o Auto-submission to screenshot websites.
|
||||
<br>
|
||||
o Running a script on resultant image to process screenshots further.
|
||||
<br>
|
||||
o Screenshot post-processing using convert(1)
|
||||
<br>
|
||||
o Lots more eyecandy, 'cos I love it.
|
||||
|
||||
<p>
|
||||
|
||||
Bug reports, feature requests, and positive vibes to:
|
||||
<br>
|
||||
gilbertt@tomgilbert.freeserve.co.uk
|
After Width: | Height: | Size: 130 KiB |
|
@ -0,0 +1,563 @@
|
|||
/* E-ScreenShoot.c
|
||||
*
|
||||
* Copyright (C) 1999 Tom Gilbert
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
|
||||
#include <epplet.h>
|
||||
#include "utils.h"
|
||||
#include "cloak.h"
|
||||
#include "E-ScreenShoot.h"
|
||||
|
||||
static void
|
||||
save_config (void)
|
||||
{
|
||||
char buf[10];
|
||||
sprintf (buf, "%d", opt.quality);
|
||||
Epplet_modify_config ("QUALITY", buf);
|
||||
sprintf (buf, "%d", opt.win);
|
||||
Epplet_modify_config ("WIN_AREA", buf);
|
||||
sprintf (buf, "%.1f", opt.delay);
|
||||
Epplet_modify_config ("SHOT_DELAY", buf);
|
||||
sprintf (buf, "%.1f", opt.cloak_delay);
|
||||
Epplet_modify_config ("CLOAK_DELAY", buf);
|
||||
sprintf (buf, "%.1f", opt.draw_interval);
|
||||
Epplet_modify_config ("DRAW_INTERVAL", buf);
|
||||
sprintf (buf, "%d", opt.do_cloak);
|
||||
Epplet_modify_config ("DO_CLOAK", buf);
|
||||
sprintf (buf, "%d", opt.cloak_anim);
|
||||
Epplet_modify_config ("CLOAK_ANIM", buf);
|
||||
sprintf (buf, "%d", opt.frame);
|
||||
Epplet_modify_config ("WM_FRAME", buf);
|
||||
sprintf (buf, "%d", opt.beep);
|
||||
Epplet_modify_config ("BEEP", buf);
|
||||
sprintf (buf, "%d", opt.run_script);
|
||||
Epplet_modify_config ("RUN_SCRIPT", buf);
|
||||
Epplet_modify_config ("DIRECTORY", opt.dir);
|
||||
Epplet_modify_config ("FILE_PREFIX", opt.file_prefix);
|
||||
Epplet_modify_config ("FILE_STAMP", opt.file_stamp);
|
||||
Epplet_modify_config ("FILE_TYPE", opt.file_type);
|
||||
Epplet_modify_config ("SCRIPT_TO_RUN", opt.script);
|
||||
}
|
||||
|
||||
static void
|
||||
load_config (void)
|
||||
{
|
||||
opt.quality = atoi (Epplet_query_config_def ("QUALITY", "75"));
|
||||
invquality = (100 - opt.quality);
|
||||
opt.win = atoi (Epplet_query_config_def ("WIN_AREA", "0"));
|
||||
opt.run_script = atoi (Epplet_query_config_def ("RUN_SCRIPT", "0"));
|
||||
opt.frame = atoi (Epplet_query_config_def ("WM_FRAME", "1"));
|
||||
opt.do_cloak = atoi (Epplet_query_config_def ("DO_CLOAK", "1"));
|
||||
opt.beep = atoi (Epplet_query_config_def ("BEEP", "1"));
|
||||
opt.cloak_anim = atoi (Epplet_query_config_def ("CLOAK_ANIM", "8"));
|
||||
opt.delay = atof (Epplet_query_config_def ("SHOT_DELAY", "0"));
|
||||
opt.cloak_delay = atof (Epplet_query_config_def ("CLOAK_DELAY", "4"));
|
||||
opt.draw_interval = atof (Epplet_query_config_def ("DRAW_INTERVAL", "0.1"));
|
||||
if (opt.dir)
|
||||
free (opt.dir);
|
||||
opt.dir = _Strdup (Epplet_query_config_def ("DIRECTORY", "~/"));
|
||||
if (opt.file_prefix)
|
||||
free (opt.file_prefix);
|
||||
opt.file_prefix =
|
||||
_Strdup (Epplet_query_config_def ("FILE_PREFIX", "shot_"));
|
||||
if (opt.file_stamp)
|
||||
free (opt.file_stamp);
|
||||
opt.file_stamp =
|
||||
_Strdup (Epplet_query_config_def
|
||||
("FILE_STAMP", "`date +%d-%m-%y_%H%M%S`"));
|
||||
if (opt.file_type)
|
||||
free (opt.file_type);
|
||||
opt.file_type = _Strdup (Epplet_query_config_def ("FILE_TYPE", "jpg"));
|
||||
if (opt.script)
|
||||
free (opt.script);
|
||||
opt.script =
|
||||
_Strdup (Epplet_query_config_def ("SCRIPT_TO_RUN", "scrshot_script"));
|
||||
}
|
||||
|
||||
static void
|
||||
cb_close (void *data)
|
||||
{
|
||||
save_config ();
|
||||
Esync ();
|
||||
Epplet_unremember ();
|
||||
exit (0);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_help (void *data)
|
||||
{
|
||||
Epplet_show_about ("E-ScreenShoot");
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cloak_draw (void *data)
|
||||
{
|
||||
switch (opt.cloak_anim)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
blank_buf ();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
load_val = (opt.quality / 2);
|
||||
draw_flame ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
draw_radar ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
draw_aa_radar ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
draw_aa_triangle ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
draw_aa_star ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
draw_starfield ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
draw_aa_starfield ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
draw_rotator ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
draw_scanner ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
draw_colorwarp ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
draw_ball ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
draw_atoms ();
|
||||
Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
blank_buf ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Epplet_paste_buf (buf, win, 0, 0);
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cloak_epplet (void *data)
|
||||
{
|
||||
if (!cloaked)
|
||||
{
|
||||
Epplet_gadget_hide (btn_close);
|
||||
Epplet_gadget_hide (btn_conf);
|
||||
Epplet_gadget_hide (btn_help);
|
||||
Epplet_gadget_hide (btn_shoot);
|
||||
Epplet_gadget_hide (sldr_qual);
|
||||
Epplet_gadget_hide (tog_win);
|
||||
Epplet_gadget_show (da);
|
||||
cloak_draw (NULL);
|
||||
cloaked = 1;
|
||||
}
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_cloak_anim (void *data)
|
||||
{
|
||||
cb_in (NULL, 0);
|
||||
opt.do_cloak = 1;
|
||||
opt.cloak_anim = *((int *) data);
|
||||
Epplet_timer (cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_cloak_delay (void *data)
|
||||
{
|
||||
Epplet_remove_timer ("CLOAK_TIMER");
|
||||
opt.cloak_delay = *(int *) data;
|
||||
Epplet_timer (cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_shot_delay (void *data)
|
||||
{
|
||||
opt.delay = *(int *) data;
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_dont_cloak (void *data)
|
||||
{
|
||||
opt.do_cloak = 0;
|
||||
Epplet_remove_timer ("CLOAK_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_quality (void *data)
|
||||
{
|
||||
opt.quality = (100 - invquality);
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_in (void *data, Window w)
|
||||
{
|
||||
if (cloaked)
|
||||
{
|
||||
Epplet_gadget_hide (da);
|
||||
cloaked = 0;
|
||||
Epplet_gadget_show (btn_close);
|
||||
Epplet_gadget_show (btn_conf);
|
||||
Epplet_gadget_show (btn_help);
|
||||
Epplet_gadget_show (btn_shoot);
|
||||
Epplet_gadget_show (sldr_qual);
|
||||
Epplet_gadget_show (tog_win);
|
||||
}
|
||||
Epplet_remove_timer ("CLOAK_TIMER");
|
||||
Epplet_remove_timer ("DRAW_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
w = (Window) 0;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_out (void *data, Window w)
|
||||
{
|
||||
Epplet_remove_timer ("CLOAK_TIMER");
|
||||
if ((!cloaked) && (opt.do_cloak))
|
||||
Epplet_timer (cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
w = (Window) 0;
|
||||
}
|
||||
|
||||
/* Amongst all the fluff, this is the bit that does the actual work. */
|
||||
static void
|
||||
do_shot (void *data)
|
||||
{
|
||||
char *sys;
|
||||
char qual_buf[5];
|
||||
char *filename_buf;
|
||||
char frame_buf[10];
|
||||
char beep_buf[20];
|
||||
|
||||
sprintf (qual_buf, "%d", opt.quality);
|
||||
|
||||
filename_buf =
|
||||
_Strjoin (NULL, opt.dir, opt.file_prefix, opt.file_stamp, ".",
|
||||
opt.file_type, NULL);
|
||||
|
||||
if (opt.frame)
|
||||
sprintf (frame_buf, "-frame");
|
||||
else
|
||||
frame_buf[0] = '\0';
|
||||
|
||||
if (opt.beep)
|
||||
beep_buf[0] = '\0';
|
||||
else
|
||||
sprintf (beep_buf, "-silent");
|
||||
|
||||
if (!opt.win)
|
||||
{
|
||||
sys = _Strjoin (" ",
|
||||
"import",
|
||||
beep_buf,
|
||||
"-window", "root", "-quality", qual_buf, filename_buf,
|
||||
"&", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
sys = _Strjoin (" ",
|
||||
"import", beep_buf, frame_buf, "-quality", qual_buf,
|
||||
filename_buf, "&", NULL);
|
||||
}
|
||||
|
||||
system (sys);
|
||||
free (sys);
|
||||
free (filename_buf);
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_shoot (void *data)
|
||||
{
|
||||
Epplet_remove_timer ("SHOOT_TIMER");
|
||||
if (opt.delay < 1)
|
||||
do_shot (NULL);
|
||||
else
|
||||
Epplet_timer (do_shot, NULL, opt.delay, "SHOOT_TIMER");
|
||||
return;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_color (void *data)
|
||||
{
|
||||
int *d;
|
||||
|
||||
d = (int *) data;
|
||||
flame_col (d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8]);
|
||||
Epplet_gadget_hide (col_p);
|
||||
}
|
||||
|
||||
static void
|
||||
create_epplet_layout (void)
|
||||
{
|
||||
Epplet_gadget_show (btn_close = Epplet_create_button (NULL, NULL,
|
||||
2, 2, 0, 0, "CLOSE",
|
||||
0, NULL, cb_close,
|
||||
NULL));
|
||||
Epplet_gadget_show (btn_help =
|
||||
Epplet_create_button (NULL, NULL, 18, 2, 0, 0, "HELP",
|
||||
0, NULL, cb_help, NULL));
|
||||
Epplet_gadget_show (btn_shoot =
|
||||
Epplet_create_button (NULL,
|
||||
EROOT
|
||||
"/epplet_icons/E-ScreenShoot_shoot.png",
|
||||
23, 31, 22, 13, 0, 0, NULL,
|
||||
cb_shoot, NULL));
|
||||
Epplet_gadget_show (tog_win =
|
||||
Epplet_create_togglebutton (NULL,
|
||||
EROOT
|
||||
"/epplet_icons/E-ScreenShoot_win.png",
|
||||
11, 17, 10, 13, &opt.win,
|
||||
NULL, NULL));
|
||||
Epplet_gadget_show (sldr_qual =
|
||||
Epplet_create_vslider (2, 17, 28, 0, 100, 1, 25,
|
||||
&invquality, cb_quality, NULL));
|
||||
p = Epplet_create_popup ();
|
||||
Epplet_add_popup_entry (p, "Don't Cloak", NULL, cb_dont_cloak, NULL);
|
||||
Epplet_add_popup_entry (p, "Blank Epplet", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[0])));
|
||||
Epplet_add_popup_entry (p, "RasterFire", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[1])));
|
||||
Epplet_add_popup_entry (p, "Radar", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[2])));
|
||||
Epplet_add_popup_entry (p, "AA Radar", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[3])));
|
||||
Epplet_add_popup_entry (p, "AA Triangle", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[4])));
|
||||
Epplet_add_popup_entry (p, "AA Star", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[5])));
|
||||
Epplet_add_popup_entry (p, "Starfield", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[6])));
|
||||
Epplet_add_popup_entry (p, "AA Starfield", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[7])));
|
||||
Epplet_add_popup_entry (p, "Rotator", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[8])));
|
||||
Epplet_add_popup_entry (p, "Scanner", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[9])));
|
||||
Epplet_add_popup_entry (p, "ColorShift", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[10])));
|
||||
Epplet_add_popup_entry (p, "Bouncy Ball", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[11])));
|
||||
Epplet_add_popup_entry (p, "Atoms", NULL, cb_cloak_anim,
|
||||
(void *) (&(cloak_anims[12])));
|
||||
|
||||
col_p = Epplet_create_popup ();
|
||||
Epplet_add_popup_entry (col_p, "Flame Colors", NULL, NULL, NULL);
|
||||
Epplet_add_popup_entry (col_p, "Funky", NULL, cb_color,
|
||||
(void *) (&(colors[0 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Turquoise", NULL, cb_color,
|
||||
(void *) (&(colors[1 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Fire", NULL, cb_color,
|
||||
(void *) (&(colors[2 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Copper", NULL, cb_color,
|
||||
(void *) (&(colors[3 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Violet", NULL, cb_color,
|
||||
(void *) (&(colors[4 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Night", NULL, cb_color,
|
||||
(void *) (&(colors[5 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Sunrise", NULL, cb_color,
|
||||
(void *) (&(colors[6 * 9])));
|
||||
Epplet_add_popup_entry (col_p, "Sunset", NULL, cb_color,
|
||||
(void *) (&(colors[7 * 9])));
|
||||
|
||||
ctimer_p = Epplet_create_popup ();
|
||||
Epplet_add_popup_entry (ctimer_p, "Cloak Delay", NULL, NULL, NULL);
|
||||
Epplet_add_popup_entry (ctimer_p, "1 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[0])));
|
||||
Epplet_add_popup_entry (ctimer_p, "2 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[1])));
|
||||
Epplet_add_popup_entry (ctimer_p, "3 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[2])));
|
||||
Epplet_add_popup_entry (ctimer_p, "4 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[3])));
|
||||
Epplet_add_popup_entry (ctimer_p, "5 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[4])));
|
||||
Epplet_add_popup_entry (ctimer_p, "10 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[5])));
|
||||
Epplet_add_popup_entry (ctimer_p, "15 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[6])));
|
||||
Epplet_add_popup_entry (ctimer_p, "20 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[7])));
|
||||
Epplet_add_popup_entry (ctimer_p, "30 Sec", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[8])));
|
||||
Epplet_add_popup_entry (ctimer_p, "1 min", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[9])));
|
||||
Epplet_add_popup_entry (ctimer_p, "2 mins", NULL, cb_cloak_delay,
|
||||
(void *) (&(cloak_delays[10])));
|
||||
|
||||
stimer_p = Epplet_create_popup ();
|
||||
Epplet_add_popup_entry (stimer_p, "Shot Delay", NULL, NULL, NULL);
|
||||
Epplet_add_popup_entry (stimer_p, "No Delay", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[0])));
|
||||
Epplet_add_popup_entry (stimer_p, "1 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[1])));
|
||||
Epplet_add_popup_entry (stimer_p, "2 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[2])));
|
||||
Epplet_add_popup_entry (stimer_p, "3 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[3])));
|
||||
Epplet_add_popup_entry (stimer_p, "4 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[4])));
|
||||
Epplet_add_popup_entry (stimer_p, "5 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[5])));
|
||||
Epplet_add_popup_entry (stimer_p, "10 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[6])));
|
||||
Epplet_add_popup_entry (stimer_p, "15 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[7])));
|
||||
Epplet_add_popup_entry (stimer_p, "20 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[8])));
|
||||
Epplet_add_popup_entry (stimer_p, "30 Sec", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[9])));
|
||||
Epplet_add_popup_entry (stimer_p, "1 min", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[10])));
|
||||
Epplet_add_popup_entry (stimer_p, "2 mins", NULL, cb_shot_delay,
|
||||
(void *) (&(shot_delays[11])));
|
||||
|
||||
|
||||
Epplet_gadget_show (btn_conf = Epplet_create_popupbutton (NULL, NULL,
|
||||
34, 2, 12, 12,
|
||||
"CONFIGURE", p));
|
||||
Epplet_gadget_show (btn_col =
|
||||
Epplet_create_popupbutton (NULL,
|
||||
EROOT
|
||||
"/epplet_icons/E-ScreenShoot_col.png",
|
||||
11, 31, 10, 13, NULL,
|
||||
col_p));
|
||||
Epplet_gadget_show (btn_ctimer =
|
||||
Epplet_create_popupbutton (NULL,
|
||||
EROOT
|
||||
"/epplet_icons/E-ScreenShoot_minitime.png",
|
||||
23, 17, 10, 13, NULL,
|
||||
ctimer_p));
|
||||
|
||||
Epplet_gadget_show (btn_stimer =
|
||||
Epplet_create_popupbutton (NULL,
|
||||
EROOT
|
||||
"/epplet_icons/E-ScreenShoot_minitime2.png",
|
||||
35, 17, 10, 13, NULL,
|
||||
stimer_p));
|
||||
|
||||
|
||||
da = Epplet_create_drawingarea (2, 2, 44, 44);
|
||||
win = Epplet_get_drawingarea_window (da);
|
||||
buf = Epplet_make_rgb_buf (40, 40);
|
||||
|
||||
cloaked = 0;
|
||||
set_flame_col (0);
|
||||
if (opt.do_cloak)
|
||||
Epplet_timer (cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
|
||||
|
||||
Epplet_register_mouse_enter_handler (cb_in, (void *) win);
|
||||
Epplet_register_mouse_leave_handler (cb_out, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int prio;
|
||||
|
||||
prio = getpriority (PRIO_PROCESS, getpid ());
|
||||
setpriority (PRIO_PROCESS, getpid (), prio + 10);
|
||||
|
||||
atexit (Epplet_cleanup);
|
||||
|
||||
/* Initialise random numbers */
|
||||
srand (time (0));
|
||||
|
||||
Epplet_Init ("E-ScreenShoot", "0.7", "Enlightenment Screen Shootin' Epplet",
|
||||
3, 3, argc, argv, 0);
|
||||
Epplet_load_config ();
|
||||
|
||||
load_config ();
|
||||
create_epplet_layout ();
|
||||
|
||||
Epplet_show ();
|
||||
Epplet_Loop ();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
Epplet_gadget btn_shoot, btn_conf, btn_close, btn_help, btn_ctimer;
|
||||
Epplet_gadget tog_win, btn_col, btn_stimer;
|
||||
Epplet_gadget sldr_qual;
|
||||
Epplet_gadget p, col_p, ctimer_p, stimer_p;
|
||||
Window win;
|
||||
RGB_buf buf;
|
||||
Epplet_gadget da;
|
||||
int cloaked = 0;
|
||||
extern int load_val;
|
||||
extern int colors[];
|
||||
static void cb_in (void *data, Window w);
|
||||
int invquality = 0;
|
||||
|
||||
int cloak_anims[] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
|
||||
};
|
||||
int cloak_delays[] = {
|
||||
1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120
|
||||
};
|
||||
int shot_delays[] = {
|
||||
0, 1, 2, 3, 4, 5, 10, 15, 20, 30, 60, 120
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
int quality;
|
||||
int win;
|
||||
int beep;
|
||||
int cloak_anim;
|
||||
int frame;
|
||||
int do_cloak;
|
||||
int run_script;
|
||||
double delay;
|
||||
double cloak_delay;
|
||||
double draw_interval;
|
||||
char *dir;
|
||||
char *file_prefix;
|
||||
char *file_stamp;
|
||||
char *file_type;
|
||||
char *script;
|
||||
}
|
||||
opt;
|
After Width: | Height: | Size: 484 B |
After Width: | Height: | Size: 208 B |
After Width: | Height: | Size: 194 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 197 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 161 B |
|
@ -5,7 +5,7 @@ bindir = $(EBIN)
|
|||
bin_PROGRAMS = E-Load.epplet E-Clock.epplet E-Time.epplet E-Net.epplet \
|
||||
E-Cpu.epplet EppletTest.epplet E-Biff.epplet E-Power.epplet Emix.epplet \
|
||||
E-MemWatch.epplet E-Disk.epplet E-Areas.epplet EppletConfigTest.epplet \
|
||||
E-NetFlame.epplet E-Sys.epplet
|
||||
E-NetFlame.epplet E-Sys.epplet E-ScreenShoot.epplet
|
||||
|
||||
E_Load_epplet_SOURCES = E-Load.c
|
||||
E_Load_epplet_DEPENDENCIES = $(top_srcdir)/api/libepplet.la
|
||||
|
@ -67,6 +67,11 @@ Emix_epplet_SOURCES = Emix.c
|
|||
Emix_epplet_DEPENDENCIES = $(top_srcdir)/api/libepplet.la
|
||||
Emix_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
|
||||
|
||||
E_ScreenShoot_epplet_SOURCES = \
|
||||
E-ScreenShoot.c E-ScreenShoot.h cloak.c utils.c utils.h cloak.h
|
||||
E_ScreenShoot_epplet_DEPENDENCIES = $(top_srcdir)/api/libepplet.la
|
||||
E_ScreenShoot_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
|
||||
|
||||
E_Areas_epplet_SOURCES = E-Areas.c
|
||||
E_Areas_epplet_DEPENDENCIES = $(top_srcdir)/api/libepplet.la
|
||||
E_Areas_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
|
||||
|
@ -79,17 +84,25 @@ E-Cpu.ABOUT/MAIN E-Cpu.ABOUT/bg.png E-Cpu.ABOUT/aircut3.ttf \
|
|||
E-Clock.ABOUT/MAIN E-Clock.ABOUT/bg.png E-Clock.ABOUT/aircut3.ttf \
|
||||
E-Power.ABOUT/MAIN E-Power.ABOUT/bg.png E-Power.ABOUT/aircut3.ttf \
|
||||
E-NetFlame.ABOUT/MAIN E-NetFlame.ABOUT/bg.png E-NetFlame.ABOUT/aircut3.ttf \
|
||||
Emix.ABOUT/MAIN Emix.ABOUT/bg.png Emix.ABOUT/aircut3.ttf
|
||||
Emix.ABOUT/MAIN Emix.ABOUT/bg.png Emix.ABOUT/aircut3.ttf \
|
||||
E-ScreenShoot.ABOUT/MAIN E-ScreenShoot.ABOUT/bg.png \
|
||||
E-ScreenShoot.ABOUT/aircut3.ttf \
|
||||
E-ScreenShoot.ABOUT/E_ScreenShoot_buttons.png \
|
||||
E-ScreenShoot.ABOUT/E_ScreenShoot_cloak.png
|
||||
|
||||
|
||||
ICONS = \
|
||||
E-Load.icon E-Clock.icon E-Net.icon E-Cpu.icon E-Power.icon E-Biff.icon \
|
||||
Emix.icon E-NetFlame.icon
|
||||
Emix.icon E-NetFlame.icon E-ScreenShoot.icon
|
||||
|
||||
IMAGES =\
|
||||
E-Clock-Image.png E-Power-Bat-0.png E-Power-Bat-10.png E-Power-Bat-20.png \
|
||||
E-Power-Bat-30.png E-Power-Bat-40.png E-Power-Bat-50.png E-Power-Bat-60.png \
|
||||
E-Power-Bat-70.png E-Power-Bat-80.png E-Power-Bat-90.png E-Power-Bat-100.png \
|
||||
nomail.png newmail.png 7of9.png
|
||||
nomail.png newmail.png 7of9.png \
|
||||
E-ScreenShoot_root.png E-ScreenShoot_col.png \
|
||||
E-ScreenShoot_shoot.png E-ScreenShoot_win.png E-ScreenShoot_time.png \
|
||||
E-ScreenShoot_minitime.png E-ScreenShoot_minitime2.png
|
||||
|
||||
EXTRA_DIST = ${ICONS} ${ABOUT_DOCS} ${IMAGES}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/* Just blank the epplet, kind of like the blank-screen screensaver */
|
||||
void blank_buf (void);
|
||||
/* Draw a flame on the epplet, a la Raster's E-Cpu.epplet*/
|
||||
void draw_flame (void);
|
||||
void set_flame_col (int j);
|
||||
void flame_col (int r1, int g1, int b1, int r2, int g2, int b2, int r3,
|
||||
int g3, int b3);
|
||||
/* Radar thing by me */
|
||||
void draw_radar (void);
|
||||
void draw_aa_radar (void);
|
||||
/* Triangle thingummy */
|
||||
void draw_aa_triangle (void);
|
||||
/* Star thingummys */
|
||||
void draw_aa_star (void);
|
||||
void draw_starfield (void);
|
||||
void draw_aa_starfield (void);
|
||||
void draw_rotator (void);
|
||||
void draw_scanner (void);
|
||||
void draw_colorwarp (void);
|
||||
void draw_ball(void);
|
||||
void draw_atoms(void);
|
|
@ -0,0 +1,66 @@
|
|||
#include <epplet.h>
|
||||
#include "utils.h"
|
||||
|
||||
/* Sorry about these next two functions...
|
||||
* I kind of needed them to do a quick port...
|
||||
* I'll fix this up later :)
|
||||
*/
|
||||
|
||||
char *
|
||||
_Strdup (char *s)
|
||||
{
|
||||
char *ss;
|
||||
int len;
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
len = strlen (s);
|
||||
ss = malloc (len + 1);
|
||||
memcpy (ss, s, len + 1);
|
||||
return ss;
|
||||
}
|
||||
|
||||
char *
|
||||
_Strjoin (const char *separator, ...)
|
||||
{
|
||||
char *string, *s;
|
||||
va_list args;
|
||||
int len;
|
||||
int separator_len;
|
||||
|
||||
if (separator == NULL)
|
||||
separator = "";
|
||||
|
||||
separator_len = strlen (separator);
|
||||
va_start (args, separator);
|
||||
s = va_arg (args, char *);
|
||||
|
||||
if (s)
|
||||
{
|
||||
len = strlen (s);
|
||||
s = va_arg (args, char *);
|
||||
while (s)
|
||||
{
|
||||
len += separator_len + strlen (s);
|
||||
s = va_arg (args, char *);
|
||||
}
|
||||
va_end (args);
|
||||
string = malloc (sizeof (char) * (len + 1));
|
||||
*string = 0;
|
||||
va_start (args, separator);
|
||||
s = va_arg (args, char *);
|
||||
strcat (string, s);
|
||||
s = va_arg (args, char *);
|
||||
while (s)
|
||||
{
|
||||
strcat (string, separator);
|
||||
strcat (string, s);
|
||||
s = va_arg (args, char *);
|
||||
}
|
||||
}
|
||||
else
|
||||
string = _Strdup ("");
|
||||
va_end (args);
|
||||
|
||||
return string;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
char *_Strdup (char *s);
|
||||
char *_Strjoin (const char *separator, ...);
|