-
/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
#include <errno.h>
-#include "empty_svg.h"
-
struct fifo_struct {
int pid;
// 1 = update from client, 2 = client closes, 3 = quit
};
SvgWin::SvgWin(SvgMain *client)
- : PluginClientWindow(client, 420, 210, 420, 210, 1)
+ : PluginClientWindow(client, xS(420), yS(210), xS(420), yS(210), 1)
{
this->client = client;
this->editing = 0;
void SvgWin::create_objects()
{
+ int xs10 = xS(10), xs15 = xS(15);
+ int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys15 = yS(15);
BC_Title *title;
- int x0 = 10, y = 10;
+ int x0 = xs10, y = ys10;
add_tool(title = new BC_Title(x0, y, _("Out X:")));
- int x1 = x0 + title->get_w() + 10;
+ int x1 = x0 + title->get_w() + xs10;
out_x = new SvgCoord(this, client, x1, y, &client->config.out_x);
out_x->create_objects();
- int x2 = x1 + out_x->get_w() + 15;
+ int x2 = x1 + out_x->get_w() + xs15;
add_tool(title = new BC_Title(x2, y, _("Out W:")));
- int x3 = x2 + title->get_w() + 10;
+ int x3 = x2 + title->get_w() + xs10;
out_w = new SvgCoord(this, client, x3, y, &client->config.out_w);
out_w->create_objects();
- y += out_x->get_h() + 5;
+ y += out_x->get_h() + ys5;
add_tool(new BC_Title(x0, y, _("Out Y:")));
out_y = new SvgCoord(this, client, x1, y, &client->config.out_y);
add_tool(title = new BC_Title(x2, y, _("Out H:")));
out_h = new SvgCoord(this, client, x3, y, &client->config.out_h);
out_h->create_objects();
- y += out_y->get_h() + 20;
+ y += out_y->get_h() + ys20;
add_tool(title = new BC_Title(x0, y, _("DPI:")));
dpi = new DpiValue(this, client, x1, y, &client->config.dpi);
dpi->create_objects();
add_tool(dpi_button = new DpiButton(this, client, x2, y));
dpi_button->create_objects();
- y += dpi->get_h() + 20;
+ y += dpi->get_h() + ys20;
add_tool(svg_file_title = new BC_Title(x0, y, client->config.svg_file));
- y += svg_file_title->get_h() + 5;
+ y += svg_file_title->get_h() + ys5;
struct stat st;
int64_t ms_time = stat(client->config.svg_file, &st) ? 0 :
st.st_mtim.tv_sec*1000 + st.st_mtim.tv_nsec/1000000;
ctime_r(&tm ,mtime);
}
add_tool(svg_file_mstime = new BC_Title(x0, y, mtime));
- y += svg_file_mstime->get_h() + 15;
+ y += svg_file_mstime->get_h() + ys15;
- y = get_h() - NewSvgButton::calculate_h() - 5;
+ y = get_h() - NewSvgButton::calculate_h() - ys5;
add_tool(new_svg_button = new NewSvgButton(client, this, x0, y));
- y = get_h() - EditSvgButton::calculate_h() - 5;
- add_tool(edit_svg_button = new EditSvgButton(client, this, x0+300, y));
+ y = get_h() - EditSvgButton::calculate_h() - ys5;
+ add_tool(edit_svg_button = new EditSvgButton(client, this, x0+xS(300), y));
show_window();
flush();
}
SvgCoord::SvgCoord(SvgWin *win, SvgMain *client, int x, int y, float *value)
- : BC_TumbleTextBox(win, *value, (float)0, (float)3000, x, y, 100)
+ : BC_TumbleTextBox(win, *value, (float)0, (float)3000, x, y, xS(100))
{
//printf("SvgWidth::SvgWidth %f\n", client->config.w);
this->client = client;
}
new_window = new NewSvgWindow(client, window, directory);
new_window->create_objects();
+ new_window->lock_window("NewSvgButton::run");
new_window->update_filter("*.svg");
+ new_window->unlock_window();
result = new_window->run_window();
const char *filepath = new_window->get_path(0);
strcpy(filename, filepath ? filepath : "" );
else {
FILE *out = fopen(filename,"w");
if( out ) {
- unsigned long size = sizeof(empty_svg) - 4;
- fwrite(empty_svg+4, size, 1, out);
+ extern unsigned char _binary_new_svg_start[];
+ extern unsigned char _binary_new_svg_end[];
+ unsigned int *ip = (unsigned int *)_binary_new_svg_start;
+ unsigned int hdr_sz = *ip++;
+ unsigned char *dp = (unsigned char *)ip + hdr_sz;
+ unsigned char *ep = _binary_new_svg_end;
+ fwrite(dp, ep - dp, 1, out);
fclose(out);
result = 0;
}
if( ret != sizeof(fifo_buf) ) continue;
switch( fifo_buf.action ) {
case 1: break;
- case 2: printf(_("Inkscape has exited\n"));
+ case 2: // printf(_("Inkscape has exited\n"));
break;
- case 3: printf(_("Plugin window has closed\n"));
+ case 3: // printf(_("Plugin window has closed\n"));
done = 1;
break;
}
DpiValue::DpiValue(SvgWin *win, SvgMain *client, int x, int y, float *value)
- : BC_TumbleTextBox(win, *value, (float)10, (float)1000, x, y, 100)
+ : BC_TumbleTextBox(win, *value, 10.f, 1000.f, x, y, xS(100), 2)
{
//printf("SvgWidth::SvgWidth %f\n", client->config.w);
this->client = client;