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

📄 threedlg.h

📁 代码格式化工具。 其实就是linux下indent的windows版本。
💻 H
字号:
#pragma once
#include "stdafx.h"
#include "macro.h"
extern "C"{
#include "indent.h"
}

static UINT StdChildId[]=
{
	IDC_verbose,
	IDC_use_tabs,
	IDC_use_stdout,
	IDC_c_plus_plus,

	IDC_tab_size,
	IDC_ind_size,
	IDC_max_col,
	IDC_else_endif_col,
	IDC_comment_max_col,

	IDC_space_sp_semicolon,
	IDC_space_after_while,
	IDC_space_after_if,
	IDC_space_after_for,
	IDC_parentheses_space,
	IDC_proc_calls_space,
	IDC_leave_preproc_space,
	IDC_cast_space,
	IDC_blank_after_sizeof,

	IDC_star_comment_cont,
	IDC_format_comments,
	IDC_format_col1_comments,
	IDC_comment_delimiter_on_blankline
};
static UINT IndChildId[]=
{
	IDC_struct_brace_indent,
	IDC_paren_indent,
	IDC_force_preproc_width,
	IDC_extra_expression_indent,
	IDC_indent_parameters,
	IDC_unindent_displace,
	IDC_decl_indent,

	IDC_case_indent,
	IDC_continuation_indent,
	IDC_com_ind,
	IDC_brace_indent,
	IDC_case_brace_indent,
	IDC_decl_com_ind,

	IDC_ljust_decl
};
static UINT BlkChildId[]=
{
	IDC_swallow_optional_blanklines,
	IDC_procnames_start_line,
	IDC_honour_newlines,
	IDC_break_function_decl_args,
	IDC_break_function_decl_args_end,
	IDC_leave_comma,
	IDC_break_before_boolean_operator,
	IDC_braces_on_struct_decl_line,
	IDC_braces_on_func_def_line,
	IDC_btype_2,

	IDC_lineup_to_parens,
	IDC_cuddle_else,
	IDC_cuddle_do_while,

	IDC_blanklines_before_blockcomments,
	IDC_blanklines_after_declarations,
	IDC_blanklines_after_procs,
	IDC_blanklines_after_declarations_at_proctop,
	IDC_blanklines_around_conditional_compilation
};
class CStdPage:public CDialog
{
	CToolTipCtrl m_ToolTip;
public:
	check_proc(verbose)
	check_proc(use_tabs)
	check_proc(use_stdout)
	check_proc(c_plus_plus)

	edit_proc(tab_size)
	edit_proc(ind_size)
	edit_proc(max_col)
	edit_proc(else_endif_col)
	edit_proc(comment_max_col)

	check_proc(space_sp_semicolon)
	check_proc(space_after_while)
	check_proc(space_after_if)
	check_proc(space_after_for)
	check_proc(parentheses_space)
	check_proc(proc_calls_space)
	check_proc(leave_preproc_space)
	check_proc(cast_space)
	check_proc(blank_after_sizeof)

	check_proc(star_comment_cont)
	check_proc(format_comments)
	check_proc(format_col1_comments)
	check_proc(comment_delimiter_on_blankline)

	void FillSetting(user_options_ty* ps)
	{
		
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			ps->verbose = get_verbose();
			ps->use_tabs = get_use_tabs();
			ps->use_stdout = get_use_stdout();
			ps->c_plus_plus = get_c_plus_plus();

			ps->tabsize = get_tab_size();
			ps->ind_size = get_ind_size();
			ps->max_col = get_max_col();
			ps->else_endif_col = get_else_endif_col();
			ps->comment_max_col = get_comment_max_col();

			ps->space_sp_semicolon = get_space_sp_semicolon();
			ps->space_after_while = get_space_after_while();
			ps->space_after_if = get_space_after_if();
			ps->space_after_for = get_space_after_for();
			ps->parentheses_space = get_parentheses_space();
			ps->proc_calls_space = get_proc_calls_space();
			ps->leave_preproc_space = get_leave_preproc_space();
			ps->cast_space = get_cast_space();
			ps->blank_after_sizeof = get_blank_after_sizeof();

			ps->star_comment_cont = get_star_comment_cont();
			ps->format_comments = get_format_comments();
			ps->format_col1_comments = get_format_col1_comments();
			ps->comment_delimiter_on_blankline = get_comment_delimiter_on_blankline();
		}
	}

	void FromSetting(const user_options_ty* ps)
	{
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			set_verbose(ps->verbose);
			set_use_tabs(ps->use_tabs);
			set_use_stdout(ps->use_stdout);
			set_c_plus_plus(ps->c_plus_plus);

			set_tab_size(ps->tabsize);
			set_ind_size(ps->ind_size);
			set_max_col(ps->max_col);
			set_else_endif_col(ps->else_endif_col);
			set_comment_max_col(ps->comment_max_col);

			set_space_sp_semicolon(ps->space_sp_semicolon);
			set_space_after_while(ps->space_after_while);
			set_space_after_if(ps->space_after_if);
			set_space_after_for(ps->space_after_for);
			set_parentheses_space(ps->parentheses_space);
			set_proc_calls_space(ps->proc_calls_space);
			set_leave_preproc_space(ps->leave_preproc_space);
			set_cast_space(ps->cast_space);
			set_blank_after_sizeof(ps->blank_after_sizeof);

			set_star_comment_cont(ps->star_comment_cont);
			set_format_comments(ps->format_comments);
			set_format_col1_comments(ps->format_col1_comments);
			set_comment_delimiter_on_blankline(ps->comment_delimiter_on_blankline);
		}
	}
	virtual BOOL PreTranslateMessage(MSG* pMsg)
	{
		m_ToolTip.RelayEvent(pMsg);
		return CDialog::PreTranslateMessage(pMsg);
	}
	virtual BOOL OnInitDialog()
	{
		CDialog::OnInitDialog();
		m_ToolTip.Create(this);
		m_ToolTip.SetDelayTime(100);
		for (int i=0;i< sizeof(StdChildId)/sizeof(UINT);++i)
			m_ToolTip.AddTool(GetDlgItem(StdChildId[i]),StdChildId[i]);
			//m_ToolTip.AddTool(&m_ToolTip,StdChildId[i],CRect(0,0,300,300),StdChildId[i]);
		return TRUE;
	}
};
class CBlkPage:public CDialog
{
	CToolTipCtrl m_ToolTip;
public:
	check_proc(swallow_optional_blanklines)
	check_proc(procnames_start_line)
	check_proc(honour_newlines)
	check_proc(break_function_decl_args)
	check_proc(break_function_decl_args_end)
	check_proc(leave_comma)
	check_proc(break_before_boolean_operator)
	check_proc(braces_on_struct_decl_line)
	check_proc(braces_on_func_def_line)
	check_proc(btype_2)

	check_proc(lineup_to_parens)
	check_proc(cuddle_else)
	check_proc(cuddle_do_while)

	edit_proc(blanklines_before_blockcomments)
	edit_proc(blanklines_after_declarations)
	edit_proc(blanklines_after_procs)
	edit_proc(blanklines_after_declarations_at_proctop)
	edit_proc(blanklines_around_conditional_compilation)
	void FillSetting(user_options_ty* ps)
	{
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			ps->swallow_optional_blanklines = get_swallow_optional_blanklines();
			ps->procnames_start_line = get_procnames_start_line();
			ps->honour_newlines = get_honour_newlines();
			ps->break_function_decl_args = get_break_function_decl_args();
			ps->break_function_decl_args_end = get_break_function_decl_args_end();
			ps->leave_comma = get_leave_comma();
			ps->break_before_boolean_operator = get_break_before_boolean_operator();
			ps->braces_on_struct_decl_line = get_braces_on_struct_decl_line();
			ps->braces_on_func_def_line = get_braces_on_func_def_line();
			ps->btype_2 = get_btype_2();

			ps->lineup_to_parens = get_lineup_to_parens();
			ps->cuddle_else = get_cuddle_else();
			ps->cuddle_do_while = get_cuddle_do_while();

			ps->blanklines_before_blockcomments = get_blanklines_before_blockcomments();
			ps->blanklines_after_declarations = get_blanklines_after_declarations();
			ps->blanklines_after_procs = get_blanklines_after_procs();
			ps->blanklines_after_declarations_at_proctop = get_blanklines_after_declarations_at_proctop();
			ps->blanklines_around_conditional_compilation = get_blanklines_around_conditional_compilation();
		}
	}
	void FromSetting(const user_options_ty* ps)
	{
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			set_swallow_optional_blanklines(ps->swallow_optional_blanklines);
			set_procnames_start_line(ps->procnames_start_line);
			set_honour_newlines(ps->honour_newlines);
			set_break_function_decl_args(ps->break_function_decl_args);
			set_break_function_decl_args_end(ps->break_function_decl_args_end);
			set_leave_comma(ps->leave_comma);
			set_break_before_boolean_operator(ps->break_before_boolean_operator);
			set_braces_on_struct_decl_line(ps->braces_on_struct_decl_line);
			set_braces_on_func_def_line(ps->braces_on_func_def_line);
			set_btype_2(ps->btype_2);

			set_lineup_to_parens(ps->lineup_to_parens);
			set_cuddle_else(ps->cuddle_else);
			set_cuddle_do_while(ps->cuddle_do_while);

			set_blanklines_before_blockcomments(ps->blanklines_before_blockcomments);
			set_blanklines_after_declarations(ps->blanklines_after_declarations);
			set_blanklines_after_procs(ps->blanklines_after_procs);
			set_blanklines_after_declarations_at_proctop(ps->blanklines_after_declarations_at_proctop);
			set_blanklines_around_conditional_compilation(ps->blanklines_around_conditional_compilation);
		}
	}
	virtual BOOL PreTranslateMessage(MSG* pMsg)
	{
		m_ToolTip.RelayEvent(pMsg);
		return CDialog::PreTranslateMessage(pMsg);
	}
	virtual BOOL OnInitDialog()
	{
		CDialog::OnInitDialog();
		m_ToolTip.Create(this);
		m_ToolTip.SetDelayTime(100);
		for (int i=0;i< sizeof(BlkChildId)/sizeof(UINT);++i)
			m_ToolTip.AddTool(GetDlgItem(BlkChildId[i]),BlkChildId[i]);
		return TRUE;
	}
};
class CIndPage:public CDialog
{
	CToolTipCtrl m_ToolTip;
public:
	edit_proc(struct_brace_indent)
	edit_proc(paren_indent)
	edit_proc(force_preproc_width)
	edit_proc(extra_expression_indent)
	edit_proc(indent_parameters)
	edit_proc(unindent_displace)
	edit_proc(decl_indent)

	edit_proc(case_indent)
	edit_proc(continuation_indent)
	edit_proc(com_ind)
	edit_proc(brace_indent)
	edit_proc(case_brace_indent)
	edit_proc(decl_com_ind)

	check_proc(ljust_decl)

	void FillSetting(user_options_ty* ps)
	{
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			ps->struct_brace_indent = get_struct_brace_indent();
			ps->paren_indent = get_paren_indent();
			ps->force_preproc_width = get_force_preproc_width();
			ps->extra_expression_indent = get_extra_expression_indent();
			ps->indent_parameters = get_indent_parameters();
			ps->unindent_displace = get_unindent_displace();
			ps->decl_indent = get_decl_indent();
			ps->case_indent = get_case_indent();
			ps->continuation_indent = get_continuation_indent();
			ps->com_ind = get_com_ind();
			ps->brace_indent = get_brace_indent();
			ps->case_brace_indent = get_case_brace_indent();
			ps->decl_com_ind = get_decl_com_ind();
			ps->ljust_decl = get_ljust_decl();
		}
	}
	void FromSetting(const user_options_ty* ps)
	{
		ASSERT(m_hWnd);
		if (this->m_hWnd)
		{
			set_struct_brace_indent(ps->struct_brace_indent);
			set_paren_indent(ps->paren_indent);
			set_force_preproc_width(ps->force_preproc_width);
			set_extra_expression_indent(ps->extra_expression_indent);
			set_indent_parameters(ps->indent_parameters);
			set_unindent_displace(ps->unindent_displace);
			set_decl_indent(ps->decl_indent);
			set_case_indent(ps->case_indent);
			set_continuation_indent(ps->continuation_indent);
			set_com_ind(ps->com_ind);
			set_brace_indent(ps->brace_indent);
			set_case_brace_indent(ps->case_brace_indent);
			set_decl_com_ind(ps->decl_com_ind);
			set_ljust_decl(ps->ljust_decl);
		}
	}
	virtual BOOL PreTranslateMessage(MSG* pMsg)
	{
		m_ToolTip.RelayEvent(pMsg);
		return CDialog::PreTranslateMessage(pMsg);
	}
	virtual BOOL OnInitDialog()
	{
		CDialog::OnInitDialog();
		m_ToolTip.Create(this);
		m_ToolTip.SetDelayTime(100);
		for (int i=0;i< sizeof(IndChildId)/sizeof(UINT);++i)
			m_ToolTip.AddTool(GetDlgItem(IndChildId[i]),IndChildId[i]);
		return TRUE;
	}
};

⌨️ 快捷键说明

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