⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imgedit.h

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "macros.h"

#ifdef __OS2_PM__
#include "img_os2.h"
#else
#include "img_win.h"
#include "bitmap.h"
#include "palette.h"
#include "ctl3d.h"
#include "wrdll.h"
#endif

typedef enum {
    UNDEF_IMG   = 0,
    BITMAP_IMG  = 1,
    ICON_IMG    = 2,
    CURSOR_IMG  = 3
} wie_imgtype;

typedef enum {
    NORMAL_CLR  = 0,
    INVERSE_CLR = 1,
    SCREEN_CLR  = 2
} wie_clrtype;

#include "wpi.h"
#include "img_wpi.h"
#include "watcom.h"
#include "fill.h"
#include "bits.h"
#include "errors.h"
#include "dialogs.h"
#include "icon.h"
#include "menuids.h"
#include "mem.h"
#include "wstatus.h"
#include "wptoolbr.h"

#define MAX_DIM         2048
#define MIN_DIM         0
#define FALSE           0
#define TRUE            1
#define SB_SAVE_AS      1
#define SB_SAVE         0
#define LMOUSEBUTTON    0
#define RMOUSEBUTTON    1
#define STATUS_WIDTH    24
#define FUNCTIONBAR_WIDTH       26

#define BORDER_WIDTH    12      /* size of the border around the view area */

#ifndef FILE_OPENED             // this pre
#define FILE_OPENED     1
#endif

#define FILE_SAVE       2
#define DIM_DEFAULT     32              // This is temporarily the default
#define UNDEF_IMG       0
#define BITMAP_IMG      1
#define ICON_IMG        2
#define CURSOR_IMG      3
#define RESOURCE_IMG    4
#define NUMBER_OF_TOOLS 10
#define MAX_IMAGES      5               // Check this
#define HINT_TEXT_LEN   40

#define IDM_FIRSTCHILD          100

#define UM_SHOWVIEWWINDOW       (WM_USER+100)
#define UM_EXIT                 (WM_USER+101)
#define UM_EXIT_NO_SAVE         (WM_USER+102)
#define UM_SAVE_ALL             (WM_USER+103)

#define RGBQ_SIZE( bc )         ( sizeof(RGBQUAD) * ((1<<(bc))))
#define IMGED_DIM               WPI_RECTDIM

/*
 * typedefs
 */
#pragma pack (1);
typedef struct {
    WORD        file_id;
    DWORD       reserved[12];
    RGBQUAD     rgbqs[28];
} a_pal_file;
#pragma pack();

typedef struct {
    RECT        box;
    COLORREF    colour;
    COLORREF    solid_colour;
} palette_box;

typedef struct list_element {
    wie_imgtype                 imgtype;
    HWND                        hwnd;
    HWND                        viewhwnd;
    short                       width;
    short                       height;
    short                       bitcount;
    char                        fname[ _MAX_PATH ];
    BOOL                        issaved;
    WPI_POINT                   hotspot;
    HBITMAP                     hxorbitmap;
    HBITMAP                     handbitmap;
    short                       num_of_images;
    struct list_element         *next;
    struct list_element         *nexticon;
#ifndef __OS2_PM__
    WRInfo                      *wrinfo;
    WResLangNode                *lnode;
#endif
} img_node;

typedef struct {
    BOOL        ismaximized;
    short       x_pos;
    short       y_pos;
    short       last_xpos;
    short       last_ypos;
    short       width;
    short       height;
    BOOL        show_state;
    short       tool_xpos;
    short       tool_ypos;
    short       pal_xpos;
    short       pal_ypos;
    short       view_xpos;
    short       view_ypos;
    short       shift;
    BOOL        square_grid;
    short       brush_size;
    BOOL        grid_on;
} config_info;

typedef struct {
    int         settings;
    int         paste;
    int         rotate;
    int         viewwnd;
    BOOL        wrapshift;
    char        opendir[ _MAX_PATH ];
    char        savedir[ _MAX_PATH ];
    char        colour[ 10 ];
} settings_info;

/*
 * globals
 */
extern char             const PaletteClass[];
extern char             const ViewWinClass[];
extern char             const DrawAreaClassB[];
extern char             const DrawAreaClassI[];
extern char             const DrawAreaClassC[];
extern char             const BitmapPickClass[];
extern HWND             HMainWindow;
extern HWND             ClientWindow;
extern HWND             HColourPalette;
extern WPI_INST         Instance;
extern WPI_FONT         SmallFont;
extern int              ColourPlanes;
extern int              BitsPerPixel;
extern config_info      ImgedConfigInfo;
extern BOOL             ImgedIsDDE;
extern char             *IEAppTitle;
extern char             *IEImageFilter;
extern char             *IEPaletteFilter;
extern char             *IEImageUntitled;
extern char             *IESaveImageTitle;
extern char             *IEOpenImageTitle;
extern char             *IESavePaletteTitle;
extern char             *IEOpenPaletteTitle;

/*
 * function prototypes
 */
/* ieglob.c */
void IEFiniGlobalStrings( void );
BOOL IEInitGlobalStrings( void );

/* ieproc.c */
void IEEnableMenuInput( BOOL enable );
MRESULT CALLBACK ImgEdFrameProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam,
                                                            WPI_PARAM2 lparam );
extern void IEHelpRoutine( void );
extern void CALLBACK IEHelpCallBack( void );

/* ieclrpal.c */
MRESULT CALLBACK ColourPalWinProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
void CreateColourPal( void );
void CheckPaletteItem( HMENU hmenu );
void SetRGBValues( RGBQUAD *argbvals, int upperlimit );

/* clrcntls.c */
MRESULT CALLBACK ColoursWndProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
MRESULT CALLBACK ScreenWndProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
void CreateColourControls( HWND hparent );
void DisplayScreenClrs( BOOL fdisplay );
void SetNumColours( int number_of_colours );
void SetScreenClr( COLORREF screen_colour );
void ShowNewColour( int index, COLORREF newcolour, BOOL repaint );
void SetInitScreenColour( COLORREF colour );

/* curclr.c */
MRESULT CALLBACK CurrentWndProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
void CreateCurrentWnd( HWND hparent );
void SetColour( int mousebutton, COLORREF colour, COLORREF solid, wie_clrtype type );
COLORREF GetSelectedColour( int mousebutton, COLORREF *solid, wie_clrtype *type );
void VerifyCurrentClr( COLORREF screen_colour, COLORREF inverse_colour );
void SetCurrentNumColours( int colour_count );
void ChangeCurrentColour( void );

/* ieviewin.c */
HWND CreateViewWin( int width, int height );
MRESULT CALLBACK ViewWindowProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
void CheckViewItem( HMENU hmenu );
COLORREF GetBkColour( void );
void SetBkColour( COLORREF colour );
void ResetViewWindow( HWND hwnd );
void HideViewWindow( HWND hwnd );
void RePositionViewWnd( img_node *node );
void SetViewWindow( BOOL justone );
void ShowViewWindows( HWND hwnd );
BOOL IsOneViewWindow( void );

/* ieutil.c */
HBITMAP CreateViewBitmap( img_node *node );
HBITMAP DuplicateBitmap( HBITMAP hbitmap);
HBITMAP EnlargeImage( HWND hwnd );
// void ConvertToDIBitmap( HBITMAP hbitmap );
void SetIsSaved( HWND hwnd, BOOL fissaved );
void OutlineRectangle( BOOL firsttime, WPI_PRES pres, WPI_RECT *prevrc,
                                                            WPI_RECT *newrc );
void GetFnameFromPath( char *fullpath, char *fname );
void GrayEditOptions( void );
void FindOrigin( WPI_POINT *new_origin );
void SetMenus( img_node *node );

/* ietoolbr.c */
BOOL ToolBarProc(HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam );
void InitTools( HWND hparent );
void CheckToolbarItem( HMENU hmenu );
void CloseToolBar( void );
void AddHotSpotTool( BOOL faddhotspot );
void PushToolButton( WORD cmdid );

/* ieopen.c */
void SetupMenuAfterOpen( void );
int OpenImage( HANDLE hDrop );
BOOL LoadColourPalette( void );
void SetInitialOpenDir( char *new_dir );
char *GetInitOpenDir( void );
void OpenFileOnStart( char *fname );
BOOL readBitmapFromData( void *data, char *fullname, WRInfo *info, WResLangNode *lnode );
BOOL readIconFromData( void *data, char *fname, WRInfo *info, WResLangNode *lnode  );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -