mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 13:09:27 +00:00
Removed tips.
This commit is contained in:
parent
2a82911b18
commit
0f597f747d
@ -71,7 +71,6 @@
|
||||
<key command="convolution_matrix" shortcut="F9" />
|
||||
<key command="color_curve" shortcut="Ctrl+M" />
|
||||
<key command="color_curve" shortcut="F10" />
|
||||
<key command="tips" shortcut="F1" />
|
||||
<key command="options" shortcut="Ctrl+Shift+O" />
|
||||
|
||||
<!-- others -->
|
||||
@ -302,8 +301,6 @@
|
||||
<item command="options" text="&Options" />
|
||||
</menu>
|
||||
<menu text="&Help">
|
||||
<item command="tips" text="&Tips" />
|
||||
<separator />
|
||||
<item command="about" text="&About" />
|
||||
</menu>
|
||||
</menu>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,128 +0,0 @@
|
||||
# Allegro Sprite Editor tips
|
||||
# Copyright (C) 2001-2009 by David Capello
|
||||
|
||||
**********************************************************************
|
||||
\palette ase.pcx
|
||||
\image ase.pcx
|
||||
|
||||
Welcome to ASE 0.8
|
||||
|
||||
READ THIS!
|
||||
|
||||
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.
|
||||
|
||||
http://www.aseprite.org/
|
||||
**********************************************************************
|
||||
\image zoom.pcx
|
||||
|
||||
Use the <1>, <2>, <3>, <4>, <5> and <6> keys to set the zoom in the
|
||||
current editor's viewport.
|
||||
|
||||
You can use the mouse wheel too.
|
||||
**********************************************************************
|
||||
\image eyedropper.pcx
|
||||
|
||||
You can pick a color from the sprite using <Alt+Left button>. This
|
||||
replaces the ``Tool Foreground Color''.
|
||||
|
||||
<Alt+Right button> replaces the ``Tool Background Color'' and the <X>
|
||||
switches the Foreground and Background colors.
|
||||
**********************************************************************
|
||||
\image anicontrols.pcx
|
||||
The animation controls appears when you put the mouse above the status bar.
|
||||
|
||||
Also you can move through frames using the keyboard:
|
||||
|
||||
\split
|
||||
<Left> = go to previous frame
|
||||
|
||||
<Home> = go to first frame
|
||||
\next
|
||||
<Right> = go to next frame
|
||||
|
||||
<End> = go to last frame
|
||||
\done
|
||||
|
||||
<Enter> = play animation
|
||||
**********************************************************************
|
||||
\image aniedit.pcx
|
||||
|
||||
Do you want edit layers, frames and cels? Use the ``Animation Editor''.
|
||||
|
||||
Go to ``Tools > Animation Editor'' menu or press <Tab> key when you are
|
||||
editing a sprite.
|
||||
**********************************************************************
|
||||
\image newframe.pcx
|
||||
|
||||
You can add new animation frames pressing <N> key or using
|
||||
``Frame > New'' menu.
|
||||
**********************************************************************
|
||||
\image onion.pcx
|
||||
|
||||
You can use the onion-skinning feature to edit animations (press <C>
|
||||
key to see the ``Tools Setup'' window). The onion-skinning works only
|
||||
for transparent layers, the ``Background'' layer can't be used.
|
||||
**********************************************************************
|
||||
When you apply some effect (like Convolution Matrix, or Color Curves),
|
||||
you can choose the target channels:
|
||||
\split
|
||||
\image tar_rgb.pcx
|
||||
* R: Red channel
|
||||
* G: Green channel
|
||||
* B: Blue channel
|
||||
* A: Alpha channel
|
||||
\next
|
||||
\image tar_gray.pcx
|
||||
* K: Black channel
|
||||
* A: Alpha channel
|
||||
\next
|
||||
\image tar_indx.pcx
|
||||
* R: Red channel
|
||||
* G: Green channel
|
||||
* B: Blue channel
|
||||
* Index: Use directly the index
|
||||
\done
|
||||
|
||||
Also you will be able to specify to what images apply the effect:
|
||||
|
||||
\split
|
||||
\image tar_1.pcx
|
||||
Current frame in current layer
|
||||
\next
|
||||
\image tar_2.pcx
|
||||
All frames of current layer
|
||||
\next
|
||||
\image tar_3.pcx
|
||||
All layers in current frame
|
||||
\next
|
||||
\image tar_4.pcx
|
||||
All frames in all layers
|
||||
\done
|
||||
**********************************************************************
|
||||
\image colcurv.pcx
|
||||
|
||||
In the ``Color Curve'' window, you can use the <Ins> and <Del> keys to
|
||||
insert or remove vertices respectively. Also, if you press in a
|
||||
vertex with the right mouse button, the ``Point Properties'' window (to
|
||||
change the coordinates manually) will be appears.
|
||||
**********************************************************************
|
||||
\split
|
||||
\image nodither.pcx
|
||||
A RGB image without dithering.
|
||||
\next
|
||||
\image dither.pcx
|
||||
Ordered dithering method.
|
||||
\done
|
||||
|
||||
See ``Tool > Options'' menu or press <Ctrl+Shift+O>.
|
||||
**********************************************************************
|
||||
\palette sprite.pcx
|
||||
\image sprite.pcx
|
||||
And remember look for updates in:
|
||||
|
||||
http://www.aseprite.org/
|
||||
|
||||
Copyright (C) 2001-2009 by David Capello
|
Binary file not shown.
@ -67,7 +67,6 @@ COMMON_SOURCES = \
|
||||
src/commands/cmd_sprite_properties.cpp \
|
||||
src/commands/cmd_sprite_size.cpp \
|
||||
src/commands/cmd_switch_colors.cpp \
|
||||
src/commands/cmd_tips.cpp \
|
||||
src/commands/cmd_undo.cpp \
|
||||
src/commands/command.cpp \
|
||||
src/commands/commands.cpp \
|
||||
@ -94,7 +93,6 @@ COMMON_SOURCES = \
|
||||
src/dialogs/options.cpp \
|
||||
src/dialogs/playfli.cpp \
|
||||
src/dialogs/repo.cpp \
|
||||
src/dialogs/tips.cpp \
|
||||
src/dialogs/vectmap.cpp \
|
||||
src/effect/colcurve.cpp \
|
||||
src/effect/convmatr.cpp \
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "core/file_system.h"
|
||||
#include "core/modules.h"
|
||||
#include "dialogs/options.h"
|
||||
#include "dialogs/tips.h"
|
||||
#include "file/file.h"
|
||||
#include "intl/intl.h"
|
||||
#include "modules/editors.h"
|
||||
@ -272,15 +271,11 @@ int App::run()
|
||||
if (ase_mode & MODE_BATCH) {
|
||||
PRINTF("Batch mode\n");
|
||||
}
|
||||
/* run the GUI */
|
||||
// Run the GUI
|
||||
else if (ase_mode & MODE_GUI) {
|
||||
/* select language */
|
||||
// Select language
|
||||
dialogs_select_language(false);
|
||||
|
||||
// show tips only if there are not a current sprite
|
||||
if (!UIContext::instance()->get_current_sprite())
|
||||
dialogs_tips(false);
|
||||
|
||||
// support to drop files from Windows explorer
|
||||
install_drop_files();
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2010 David Capello
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include "jinete/jbase.h"
|
||||
|
||||
#include "commands/command.h"
|
||||
#include "dialogs/tips.h"
|
||||
|
||||
class TipsCommand : public Command
|
||||
{
|
||||
public:
|
||||
TipsCommand();
|
||||
|
||||
protected:
|
||||
void execute(Context* context);
|
||||
};
|
||||
|
||||
TipsCommand::TipsCommand()
|
||||
: Command("tips",
|
||||
"Tips",
|
||||
CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
void TipsCommand::execute(Context* context)
|
||||
{
|
||||
dialogs_tips(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CommandFactory
|
||||
|
||||
Command* CommandFactory::create_tips_command()
|
||||
{
|
||||
return new TipsCommand;
|
||||
}
|
@ -96,5 +96,4 @@ FOR_EACH_COMMAND(split_editor_vertically)
|
||||
FOR_EACH_COMMAND(sprite_properties)
|
||||
FOR_EACH_COMMAND(sprite_size)
|
||||
FOR_EACH_COMMAND(switch_colors)
|
||||
FOR_EACH_COMMAND(tips)
|
||||
FOR_EACH_COMMAND(undo)
|
||||
|
@ -1,523 +0,0 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2010 David Capello
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include <allegro.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "jinete/jinete.h"
|
||||
|
||||
#include "console.h"
|
||||
#include "core/cfg.h"
|
||||
#include "core/dirs.h"
|
||||
#include "intl/intl.h"
|
||||
#include "modules/gui.h"
|
||||
#include "modules/palettes.h"
|
||||
#include "raster/palette.h"
|
||||
|
||||
static Widget* tips_new();
|
||||
static int tips_type();
|
||||
static bool tips_msg_proc(JWidget widget, JMessage msg);
|
||||
static void tips_request_size(JWidget widget, int *w, int *h);
|
||||
|
||||
static JWidget tips_image_new(BITMAP *bmp);
|
||||
static int tips_image_type();
|
||||
static bool tips_image_msg_proc(JWidget widget, JMessage msg);
|
||||
|
||||
static FILE *tips_open_file();
|
||||
static int tips_count_pages();
|
||||
static void tips_load_page(JWidget widget);
|
||||
static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take);
|
||||
static BITMAP *tips_load_image(const char *filename, PALETTE pal);
|
||||
|
||||
static void prev_command(JWidget widget, void *data);
|
||||
static void next_command(JWidget widget, void *data);
|
||||
static bool check_change_hook(JWidget widget, void *data);
|
||||
|
||||
void dialogs_tips(bool forced)
|
||||
{
|
||||
JWidget vbox, hbox, box;
|
||||
JWidget button_close, button_prev, button_next;
|
||||
JWidget view, tips;
|
||||
JWidget check;
|
||||
Palette *old_pal;
|
||||
|
||||
/* don't show it? */
|
||||
if (!forced && !get_config_bool("Tips", "Show", true))
|
||||
return;
|
||||
|
||||
/* next page */
|
||||
{
|
||||
int pages = tips_count_pages();
|
||||
int page = get_config_int("Tips", "Page", -1);
|
||||
|
||||
/* error? */
|
||||
if (!pages)
|
||||
return;
|
||||
|
||||
/* first time */
|
||||
if (page == -1)
|
||||
set_config_int("Tips", "Page", 0);
|
||||
/* other times (go to next tip) */
|
||||
else {
|
||||
page = MID(0, page, pages-1);
|
||||
set_config_int("Tips", "Page", (page+1) % pages);
|
||||
}
|
||||
}
|
||||
|
||||
Frame* window = new Frame(false, PACKAGE " | tips");
|
||||
vbox = jbox_new(JI_VERTICAL);
|
||||
hbox = jbox_new(JI_HORIZONTAL);
|
||||
box = jbox_new(0);
|
||||
button_close = jbutton_new(_("&Close"));
|
||||
button_prev = jbutton_new(_("&Previous"));
|
||||
button_next = jbutton_new(_("&Next"));
|
||||
view = jview_new();
|
||||
tips = tips_new();
|
||||
check = jcheck_new(_("Show this at startup"));
|
||||
|
||||
jwidget_set_min_size(button_close, 50, 0);
|
||||
jwidget_set_min_size(button_prev, 50, 0);
|
||||
jwidget_set_min_size(button_next, 50, 0);
|
||||
|
||||
jbutton_add_command_data(button_prev, prev_command, tips);
|
||||
jbutton_add_command_data(button_next, next_command, tips);
|
||||
|
||||
HOOK(check, JI_SIGNAL_CHECK_CHANGE, check_change_hook, 0);
|
||||
|
||||
if (get_config_bool("Tips", "Show", true))
|
||||
jwidget_select(check);
|
||||
|
||||
jview_attach(view, tips);
|
||||
|
||||
jwidget_expansive(view, true);
|
||||
jwidget_expansive(box, true);
|
||||
|
||||
jwidget_add_child(vbox, view);
|
||||
jwidget_add_child(hbox, button_close);
|
||||
jwidget_add_child(box, check);
|
||||
jwidget_add_child(hbox, box);
|
||||
jwidget_add_child(hbox, button_prev);
|
||||
jwidget_add_child(hbox, button_next);
|
||||
jwidget_add_child(vbox, hbox);
|
||||
jwidget_add_child(window, vbox);
|
||||
|
||||
/* if (JI_SCREEN_W > 320) */
|
||||
jwidget_set_min_size(window,
|
||||
MIN(400, JI_SCREEN_W-32),
|
||||
MIN(300, JI_SCREEN_H-16));
|
||||
/* else */
|
||||
/* jwidget_set_static_size(window, 282, 200); */
|
||||
|
||||
/* open the window */
|
||||
window->open_window();
|
||||
jwidget_set_min_size(window, 0, 0);
|
||||
|
||||
/* load first page */
|
||||
old_pal = palette_new_copy(get_current_palette());
|
||||
tips_load_page(tips);
|
||||
|
||||
/* run the window */
|
||||
window->open_window_fg();
|
||||
jwidget_free(window);
|
||||
|
||||
/* restore the palette */
|
||||
set_current_palette(old_pal, true);
|
||||
palette_free(old_pal);
|
||||
|
||||
jmanager_refresh_screen();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Tips
|
||||
***********************************************************************/
|
||||
|
||||
static Widget* tips_new()
|
||||
{
|
||||
Widget* widget = new Widget(tips_type());
|
||||
|
||||
jwidget_add_hook(widget, tips_type(), tips_msg_proc, NULL);
|
||||
jwidget_focusrest(widget, true);
|
||||
jwidget_noborders(widget);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static int tips_type()
|
||||
{
|
||||
static int type = 0;
|
||||
if (!type)
|
||||
type = ji_register_widget_type();
|
||||
return type;
|
||||
}
|
||||
|
||||
static bool tips_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
switch (msg->type) {
|
||||
|
||||
case JM_REQSIZE:
|
||||
tips_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
||||
return true;
|
||||
|
||||
case JM_WHEEL:
|
||||
{
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
JRect vp = jview_get_viewport_position(view);
|
||||
int dz = jmouse_z(1) - jmouse_z(0);
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll(view, scroll_x, scroll_y + dz * jrect_h(vp)/3);
|
||||
|
||||
jrect_free(vp);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void tips_request_size(JWidget widget, int *w, int *h)
|
||||
{
|
||||
int max_w, max_h;
|
||||
int req_w, req_h;
|
||||
JWidget child;
|
||||
JLink link;
|
||||
|
||||
max_w = max_h = 0;
|
||||
|
||||
JI_LIST_FOR_EACH(widget->children, link) {
|
||||
child = (JWidget)link->data;
|
||||
|
||||
jwidget_request_size(child, &req_w, &req_h);
|
||||
max_w = MAX(max_w, req_w);
|
||||
max_h = MAX(max_h, req_h);
|
||||
}
|
||||
|
||||
*w = max_w;
|
||||
*h = max_h;
|
||||
}
|
||||
|
||||
static JWidget tips_image_new(BITMAP *bmp)
|
||||
{
|
||||
JWidget widget = jimage_new(bmp, JI_CENTER | JI_MIDDLE);
|
||||
jwidget_add_hook(widget, tips_image_type(),
|
||||
tips_image_msg_proc, bmp);
|
||||
return widget;
|
||||
}
|
||||
|
||||
static int tips_image_type()
|
||||
{
|
||||
static int type = 0;
|
||||
if (!type)
|
||||
type = ji_register_widget_type();
|
||||
return type;
|
||||
}
|
||||
|
||||
static bool tips_image_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_DESTROY)
|
||||
destroy_bitmap(reinterpret_cast<BITMAP*>(jwidget_get_data(widget, tips_image_type())));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static FILE *tips_open_file()
|
||||
{
|
||||
char filename[1024];
|
||||
DIRS *dirs, *dir;
|
||||
|
||||
sprintf(filename, "tips/tips.%s", intl_get_lang());
|
||||
dirs = filename_in_datadir(filename);
|
||||
|
||||
for (dir=dirs; dir; dir=dir->next) {
|
||||
if ((dir->path) && exists (dir->path)) {
|
||||
strcpy(filename, dir->path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dir)
|
||||
strcpy(filename, dirs->path);
|
||||
|
||||
dirs_free(dirs);
|
||||
|
||||
return fopen(filename, "rt");
|
||||
}
|
||||
|
||||
static int tips_count_pages()
|
||||
{
|
||||
char buf[1024];
|
||||
int page = 0;
|
||||
FILE *f;
|
||||
|
||||
f = tips_open_file();
|
||||
if (!f) {
|
||||
Console console;
|
||||
console.printf("Error loading tips files\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fgets (buf, sizeof (buf), f)) {
|
||||
if (*buf == 12)
|
||||
page++;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
if (!page) {
|
||||
Console console;
|
||||
console.printf("No pages tips file\n");
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
static void tips_load_page(JWidget widget)
|
||||
{
|
||||
int use_page = get_config_int("Tips", "Page", 0);
|
||||
char buf[1024];
|
||||
int page = 0;
|
||||
int take = true;
|
||||
FILE *f;
|
||||
|
||||
/* destroy old page */
|
||||
if (!jlist_empty(widget->children)) {
|
||||
JWidget child = reinterpret_cast<JWidget>(jlist_first(widget->children)->data);
|
||||
jwidget_remove_child(widget, child);
|
||||
jwidget_free(child);
|
||||
}
|
||||
|
||||
/* set default palette */
|
||||
set_current_palette(NULL, false);
|
||||
|
||||
f = tips_open_file();
|
||||
if (!f) {
|
||||
jwidget_add_child(widget, jlabel_new(_("Error loading tips file.")));
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
if (*buf == 12) {
|
||||
/* read this page */
|
||||
if (use_page == page) {
|
||||
JWidget vbox = tips_load_box(f, buf, sizeof(buf), &take);
|
||||
if (vbox)
|
||||
jwidget_add_child(widget, vbox);
|
||||
break;
|
||||
}
|
||||
page++;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
jview_update(jwidget_get_view(widget));
|
||||
jview_set_scroll(jwidget_get_view(widget), 0, 0);
|
||||
|
||||
jmanager_refresh_screen();
|
||||
}
|
||||
|
||||
static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
{
|
||||
JWidget vbox = jbox_new(JI_VERTICAL);
|
||||
|
||||
jwidget_set_border(vbox, 2 * jguiscale());
|
||||
|
||||
for (;;) {
|
||||
if (*take) {
|
||||
if (!fgets (buf, sizeof_buf, f))
|
||||
break;
|
||||
}
|
||||
else
|
||||
*take = true;
|
||||
|
||||
if (*buf == 12)
|
||||
break;
|
||||
/* comment */
|
||||
else if (*buf == '#')
|
||||
continue;
|
||||
|
||||
/* remove trailing space chars */
|
||||
while (*buf && isspace (ugetat (buf, -1)))
|
||||
usetat(buf, -1, 0);
|
||||
|
||||
/************************************************************/
|
||||
/* empty? */
|
||||
if (!*buf) {
|
||||
/* add a box with an static size to separate paragraphs */
|
||||
JWidget box = jbox_new(0);
|
||||
|
||||
jwidget_set_min_size(box, 0, text_height(box->getFont()));
|
||||
|
||||
jwidget_add_child(vbox, box);
|
||||
}
|
||||
/************************************************************/
|
||||
/* special object (line start with \) */
|
||||
else if (*buf == '\\') {
|
||||
/* \split */
|
||||
if (ustrncmp(buf+1, "split", 5) == 0) {
|
||||
JWidget box, hbox = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||
|
||||
do {
|
||||
box = tips_load_box(f, buf, sizeof_buf, take);
|
||||
if (box)
|
||||
jwidget_add_child(hbox, box);
|
||||
} while (ustrncmp(buf, "\\next", 5) == 0);
|
||||
|
||||
jwidget_add_child(vbox, hbox);
|
||||
*take = true;
|
||||
}
|
||||
/* \next and \done */
|
||||
else if ((ustrncmp(buf+1, "next", 4) == 0) ||
|
||||
(ustrncmp(buf+1, "done", 4) == 0)) {
|
||||
break;
|
||||
}
|
||||
/* \image filename */
|
||||
else if (ustrncmp(buf+1, "image", 5) == 0) {
|
||||
char filename[1024];
|
||||
PALETTE pal;
|
||||
BITMAP *bmp;
|
||||
|
||||
sprintf(filename, "tips/%s", strchr(buf, ' ')+1);
|
||||
bmp = tips_load_image(filename, pal);
|
||||
if (bmp) {
|
||||
JWidget image = tips_image_new(bmp);
|
||||
jwidget_add_child(vbox, image);
|
||||
}
|
||||
else {
|
||||
sprintf(buf, _("Error loading image %s"), filename);
|
||||
jwidget_add_child(vbox, jlabel_new(buf));
|
||||
}
|
||||
}
|
||||
/* \palette filename */
|
||||
else if (ustrncmp (buf+1, "palette", 7) == 0) {
|
||||
char filename[1024];
|
||||
PALETTE rgbpal;
|
||||
BITMAP *bmp;
|
||||
|
||||
sprintf(filename, "tips/%s", strchr(buf, ' ')+1);
|
||||
bmp = tips_load_image(filename, rgbpal);
|
||||
if (bmp) {
|
||||
Palette *pal = palette_new(0, MAX_PALETTE_COLORS);
|
||||
set_current_palette(palette_from_allegro(pal, rgbpal), false);
|
||||
palette_free(pal);
|
||||
|
||||
destroy_bitmap(bmp);
|
||||
}
|
||||
else {
|
||||
sprintf(buf, _("Error loading palette %s"), filename);
|
||||
jwidget_add_child(vbox, jlabel_new(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
/************************************************************/
|
||||
/* add text */
|
||||
else {
|
||||
char *text = jstrdup(buf);
|
||||
|
||||
/* read more text (to generate a paragraph) */
|
||||
if (*text != '*') {
|
||||
while (fgets(buf, sizeof_buf, f)) {
|
||||
if (*buf == 12 || *buf == '\\') {
|
||||
*take = false;
|
||||
break;
|
||||
}
|
||||
/* comment */
|
||||
else if (*buf == '#')
|
||||
continue;
|
||||
|
||||
/* remove trailing space chars */
|
||||
while (*buf && isspace(ugetat (buf, -1)))
|
||||
usetat(buf, -1, 0);
|
||||
|
||||
/* empty? */
|
||||
if (!*buf) {
|
||||
*take = false;
|
||||
break;
|
||||
}
|
||||
|
||||
/* add chars */
|
||||
text = (char*)jrealloc(text, strlen(text) + 1 + strlen(buf) + 1);
|
||||
strcat(text, " ");
|
||||
strcpy(text+strlen(text), buf);
|
||||
}
|
||||
|
||||
/* add the textbox */
|
||||
jwidget_add_child(vbox, jtextbox_new(text, JI_WORDWRAP | JI_CENTER));
|
||||
}
|
||||
else {
|
||||
/* add a label */
|
||||
jwidget_add_child(vbox, jtextbox_new(text+2, JI_WORDWRAP | JI_LEFT));
|
||||
}
|
||||
|
||||
jfree(text);
|
||||
}
|
||||
}
|
||||
|
||||
/* white background */
|
||||
jwidget_set_bg_color(vbox, makecol(255, 255, 255));
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static BITMAP *tips_load_image(const char *filename, PALETTE pal)
|
||||
{
|
||||
BITMAP *bmp = NULL;
|
||||
DIRS *dir, *dirs;
|
||||
|
||||
dirs = filename_in_datadir(filename);
|
||||
|
||||
for (dir=dirs; dir; dir=dir->next) {
|
||||
bmp = load_bitmap(dir->path, pal);
|
||||
if (bmp)
|
||||
break;
|
||||
}
|
||||
|
||||
dirs_free(dirs);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
static void prev_command(JWidget widget, void *data)
|
||||
{
|
||||
int pages = tips_count_pages();
|
||||
int page = get_config_int("Tips", "Page", 0);
|
||||
|
||||
set_config_int("Tips", "Page", page > 0 ? page-1: pages-1);
|
||||
tips_load_page((JWidget)data);
|
||||
}
|
||||
|
||||
static void next_command(JWidget widget, void *data)
|
||||
{
|
||||
int pages = tips_count_pages();
|
||||
int page = get_config_int("Tips", "Page", 0);
|
||||
|
||||
set_config_int("Tips", "Page", page < pages-1 ? page+1: 0);
|
||||
tips_load_page((JWidget)data);
|
||||
}
|
||||
|
||||
static bool check_change_hook(JWidget widget, void *data)
|
||||
{
|
||||
set_config_bool("Tips", "Show", jwidget_is_selected(widget));
|
||||
return true;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2010 David Capello
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef DIALOGS_TIPS_H_INCLUDED
|
||||
#define DIALOGS_TIPS_H_INCLUDED
|
||||
|
||||
void dialogs_tips(bool forced);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user