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

📄 subtitle.h

📁 tcpmp外挂字幕插件subs_src 源码
💻 H
字号:
/*****************************************************************************
 *
 * 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
 *
 * File    : subtitle.h
 * Created : 05/01/08
 * Purpose : Definition of main structures and settings for subtitles.
 *
 * The Core Pocket Media Player SUBS Subtitle Plugin
 * Copyright (c) 2008 Alexander Sorokin
/****************************************************************************/

#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <windowsx.h>
#include <aygshell.h>

#define SUBS_MAX_FILE_LENGTH 1024*1024*1024 // Too long subtitle file will not be loaded
#define SUBS_MAX_LINES 5*1024	// Max subtitle events in a file
#define SUBS_MAX_FONTS 30 // Max stored fonts, 1 font includes both vertical and horizontal

// SSA "Format:" specification
#define SSA_NONE 0
#define SSA_NAME 101
#define SSA_FONTNAME 102
#define SSA_FONTSIZE 103
#define SSA_FGCOLOR 104
#define SSA_B 105
#define SSA_I 106
#define SSA_U 107
#define SSA_S 108
#define SSA_BGCOLOR 109
#define SSA_START 201
#define SSA_END 202
#define SSA_STYLE 203
#define SSA_TEXT 204

typedef struct xline 
{
	wchar_t *txt;
	long beg;
	long end;
	int len; // length in lines of text; lines are separated by '\0'
	int fnt;
} xline;

struct xsubs
{
	BOOL allowed;
	int lines;
	xline T[SUBS_MAX_LINES];
	xline *S[SUBS_MAX_LINES];
	wchar_t *file;
	wchar_t *pos;
	int last;
	// This will be changable or countable settings mostly
	int br_after; // Will try to break line at first space after N symbols
	int device_height;
	int device_width;
	int line_spacing;
	int max_lines;
	BOOL orient; // TRUE if landscape
	// margins are symmetrical, so 2 are enough
	// for vertical text margins are swaped
	int margin_top;
	int margin_left;
	BOOL force_font;
	DWORD clear_color;
	// default font parameters
	BOOL def_bold;
	BOOL def_outlined;
	int def_height;
	BOOL dirtystate;
	int timing;
	BOOL al_top;
	wchar_t def_font[LF_FACESIZE];
} xsubs;

typedef struct xfont 
{
	DWORD fgcolor;
	DWORD bgcolor;
	BOOL bold;
	BOOL italic;
	BOOL underline;
	BOOL strikeout;
	BOOL outlined;
	int height; // Font height in pixels
	HFONT h;
	HFONT v;
	wchar_t *font;
	wchar_t *style;
} xfont;

xfont xfonts[SUBS_MAX_FONTS];

void xfonts_add(int id,xfont *fnt);
void xfonts_free(int id);
void xsubs_init(wchar_t * fn);
void xsubs_init_font(void);
void xsubs_free(void);
void xsubs_load(wchar_t *fn);
void xsubs_draw(HDC dc, DWORD Time);
wchar_t* smi_sync(wchar_t* ptr);
void parse_smi(void);
void parse_srt(void);
long srt_get_time(wchar_t* pos);
void parse_ssa(void);
void xsubs_sort(void);
long ssa_get_time(wchar_t* pos);
BOOL TextOutEx(HDC dc,int x,int y,LPCWSTR c,UINT d,xfont *font);

⌨️ 快捷键说明

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