diff options
author | Simon Howard | 2013-09-08 19:10:40 +0000 |
---|---|---|
committer | Simon Howard | 2013-09-08 19:10:40 +0000 |
commit | f2c204ccca3b93b318cda3aebf29592aa30385e4 (patch) | |
tree | d63ddaa28421cccdf9789673cd2cb2dc688fb982 | |
parent | f3afff090adb5af99dc6e1929a9907bf72fda920 (diff) | |
parent | e10af52152ba793d983497cd86d7ccc10d32a13d (diff) | |
download | chocolate-doom-f2c204ccca3b93b318cda3aebf29592aa30385e4.tar.gz chocolate-doom-f2c204ccca3b93b318cda3aebf29592aa30385e4.tar.bz2 chocolate-doom-f2c204ccca3b93b318cda3aebf29592aa30385e4.zip |
Merge from trunk.
Subversion-branch: /branches/v2-branch
Subversion-revision: 2639
-rw-r--r-- | codeblocks/setup-res.rc | 2 | ||||
-rw-r--r-- | src/i_oplmusic.c | 6 | ||||
-rw-r--r-- | src/midifile.c | 2 | ||||
-rw-r--r-- | textscreen/txt_fileselect.c | 25 | ||||
-rw-r--r-- | textscreen/txt_window.h | 50 |
5 files changed, 60 insertions, 25 deletions
diff --git a/codeblocks/setup-res.rc b/codeblocks/setup-res.rc index 6199cfd6..38f70c8d 100644 --- a/codeblocks/setup-res.rc +++ b/codeblocks/setup-res.rc @@ -1,7 +1,5 @@ 1 ICON "../data/setup.ico" -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "setup-manifest.xml" - 1 VERSIONINFO PRODUCTVERSION 1,99,0,0 FILEVERSION 1,99,0,0 diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c index 3d309715..62cbaca7 100644 --- a/src/i_oplmusic.c +++ b/src/i_oplmusic.c @@ -735,7 +735,7 @@ static unsigned int FrequencyForVoice(opl_voice_t *voice) gm_voice = &voice->current_instr->voices[voice->current_instr_voice]; - if ((voice->current_instr->flags & GENMIDI_FLAG_FIXED) == 0) + if ((SHORT(voice->current_instr->flags) & GENMIDI_FLAG_FIXED) == 0) { note += (signed short) SHORT(gm_voice->base_note_offset); } @@ -852,7 +852,7 @@ static void VoiceKeyOn(opl_channel_data_t *channel, // Work out the note to use. This is normally the same as // the key, unless it is a fixed pitch instrument. - if ((instrument->flags & GENMIDI_FLAG_FIXED) != 0) + if ((SHORT(instrument->flags) & GENMIDI_FLAG_FIXED) != 0) { voice->note = instrument->fixed_note; } @@ -919,7 +919,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event) VoiceKeyOn(channel, instrument, 0, key, volume); - if ((instrument->flags & GENMIDI_FLAG_2VOICE) != 0) + if ((SHORT(instrument->flags) & GENMIDI_FLAG_2VOICE) != 0) { VoiceKeyOn(channel, instrument, 1, key, volume); } diff --git a/src/midifile.c b/src/midifile.c index e9af051c..00ff28d4 100644 --- a/src/midifile.c +++ b/src/midifile.c @@ -706,7 +706,7 @@ int MIDI_GetNextEvent(midi_track_iter_t *iter, midi_event_t **event) unsigned int MIDI_GetFileTimeDivision(midi_file_t *file) { - return file->header.time_division; + return SHORT(file->header.time_division); } void MIDI_RestartIterator(midi_track_iter_t *iter) diff --git a/textscreen/txt_fileselect.c b/textscreen/txt_fileselect.c index 56fa1108..52b0dc1c 100644 --- a/textscreen/txt_fileselect.c +++ b/textscreen/txt_fileselect.c @@ -149,7 +149,7 @@ static char *ExecReadOutput(char **argv) #include <windows.h> #include <shlobj.h> -static BOOL WINAPI (*MyGetOpenFileName)(LPOPENFILENAME) = NULL; +static BOOL (*MyGetOpenFileName)(LPOPENFILENAME) = NULL; static LPITEMIDLIST (*MySHBrowseForFolder)(LPBROWSEINFO) = NULL; static BOOL (*MySHGetPathFromIDList)(LPITEMIDLIST, LPTSTR) = NULL; @@ -591,6 +591,16 @@ static int DoSelectFile(txt_fileselect_t *fileselect) { path = TXT_SelectFile(fileselect->prompt, fileselect->extensions); + + // Update inputbox variable. + // If cancel was pressed (ie. NULL was returned by TXT_SelectFile) + // then reset to empty string, not NULL). + + if (path == NULL) + { + path = strdup(""); + } + var = fileselect->inputbox->value; free(*var); *var = path; @@ -658,6 +668,16 @@ txt_widget_class_t txt_fileselect_class = TXT_FileSelectFocused, }; +// If the (inner) inputbox widget is changed, emit a change to the +// outer (fileselect) widget. + +static void InputBoxChanged(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(fileselect)) +{ + TXT_CAST_ARG(txt_fileselect_t, fileselect); + + TXT_EmitSignal(&fileselect->widget, "changed"); +} + txt_fileselect_t *TXT_NewFileSelector(char **variable, int size, char *prompt, char **extensions) { @@ -671,6 +691,9 @@ txt_fileselect_t *TXT_NewFileSelector(char **variable, int size, fileselect->prompt = prompt; fileselect->extensions = extensions; + TXT_SignalConnect(fileselect->inputbox, "changed", + InputBoxChanged, fileselect); + return fileselect; } diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index bfae2a9a..8b1e1fb9 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2006 Simon Howard @@ -49,15 +49,16 @@ typedef struct txt_window_s txt_window_t; -#include "txt_widget.h" +#include "txt_widget.h" #include "txt_table.h" #include "txt_window_action.h" // Callback function for window key presses -typedef int (*TxtWindowKeyPress)(txt_window_t *window, int key, void *user_data); -typedef int (*TxtWindowMousePress)(txt_window_t *window, - int x, int y, int b, +typedef int (*TxtWindowKeyPress)(txt_window_t *window, int key, + void *user_data); +typedef int (*TxtWindowMousePress)(txt_window_t *window, + int x, int y, int b, void *user_data); struct txt_window_s @@ -65,7 +66,7 @@ struct txt_window_s // Base class: all windows are tables with one column. txt_table_t table; - + // Window title char *title; @@ -114,17 +115,31 @@ void TXT_CloseWindow(txt_window_t *window); /** * Set the position of a window on the screen. * - * The window is specified as coordinates relative to a predefined - * position on the screen (eg. center of the screen, top left of the - * screen, etc). + * The position is specified as a pair of x, y, coordinates on the + * screen. These specify the position of a particular point on the + * window. The following are some examples: + * + * <code> + * // Centered on the screen: + * + * TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_CENTER, + * TXT_SCREEN_W / 2, TXT_SCREEN_H / 2); + * + * // Horizontally centered, with top of the window on line 6: + * + * TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, + * TXT_SCREEN_W / 2, 6); + * + * // Top-left of window at 20, 6: + * + * TXT_SetWindowPosition(window, TXT_HORIZ_LEFT, TXT_VERT_TOP, 20, 6); + * </code> * * @param window The window. - * @param horiz_align Horizontal position on the screen to which the - * coordinates are relative (left side, right side - * or center). - * @param vert_align Vertical position on the screen to which the - * coordinates are relative (top, bottom or center). - * @param x X coordinate (horizonal axis) for window position. + * @param horiz_align Horizontal location on the window for the X + * position. + * @param vert_align Vertical location on the window for the Y position. + * @param x X coordinate (horizontal axis) for window position. * @param y Y coordinate (vertical axis) for window position. */ @@ -145,7 +160,7 @@ void TXT_SetWindowPosition(txt_window_t *window, * current window action in the given slot is removed. */ -void TXT_SetWindowAction(txt_window_t *window, txt_horiz_align_t position, +void TXT_SetWindowAction(txt_window_t *window, txt_horiz_align_t position, txt_window_action_t *action); /** @@ -186,6 +201,5 @@ void TXT_SetMouseListener(txt_window_t *window, txt_window_t *TXT_MessageBox(char *title, char *message, ...); -#endif /* #ifndef TXT_WINDOW_T */ - +#endif /* #ifndef TXT_WINDOW_H */ |