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

📄 border.c

📁 一个minigui 工程框架,需要windows 下的minigui 开发环境
💻 C
📖 第 1 页 / 共 2 页
字号:
#include "const.h"
#include "resource.h"
#include "project.h"
#include "page.h"
#include "border.h"
#include "microwin.h"
#include "queue.h"
#include "liaison.h"


BOOL CreatePageBorder2(const char*objstring)
{
	int nReturn;
	int Position_left,Position_top,Position_right,Position_bottom;
	int eShape,eBackStyle;
	char* AcText_szContent,*AcText_LOG_FONT;
	int AcText_bFring,AcText_eLocation;
	unsigned long AcText_dwTextColor,AcRect_dwFaceColor,AcRect_dwFrameColor;
	int AcRect_eFrameThick,AcRect_eFaceStyle;
	int AcRect_TopLeft_x,AcRect_TopLeft_y,AcRect_BottomRight_x,AcRect_BottomRight_y,nID;

	int nRisus,nFrameSytle,nFrameContrans;
	
	_INDEX index;
	int pos =OBJECT_LEN;
	
	nReturn = TRUE;
	
	AcText_szContent=0;
	AcText_LOG_FONT=0;

	nRisus =1 ;
	nFrameSytle = eNone;
	nFrameContrans = 0;
	
	
	
	// position.left
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_left = GetLongVal(objstring,&pos);
	
	// position.top 
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  
	{
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_top = GetLongVal(objstring,&pos);
	
	// position.right
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	Position_right = GetLongVal(objstring,&pos);
	
	// position.bottom
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	Position_bottom = GetLongVal(objstring,&pos);
	
	
	
	//eShape eShape,
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	eShape = GetLongVal(objstring,&pos);
	
	
	// back style.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	eBackStyle = GetLongVal(objstring,&pos);
	
	

	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	AcText_szContent = GetStringVal(objstring,index._Length,&pos,0);
//	assert(AcText_szContent);
	
	
	// font
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=1)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	AcText_LOG_FONT = GetStringVal(objstring,index._Length,&pos,0);
//	assert(AcText_LOG_FONT);
	
	
	// fring.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcText_bFring = GetLongVal(objstring,&pos);
	
	// text location.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcText_eLocation = GetLongVal(objstring,&pos);
	
	
	////text color.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcText_dwTextColor = GetLongVal(objstring,&pos);
	
	// face color
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcRect_dwFaceColor = GetLongVal(objstring,&pos);
	
	
	// frame color.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	AcRect_dwFrameColor = GetLongVal(objstring,&pos);
	
	
	// frame thick.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	AcRect_eFrameThick = GetLongVal(objstring,&pos);
	
	// face style.
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  { 
		nReturn = FALSE; 
		goto FAILED;
	}
	AcRect_eFaceStyle = GetLongVal(objstring,&pos);
	
	
	// top left.x
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcRect_TopLeft_x = GetLongVal(objstring,&pos);
	
	// top left.y
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcRect_TopLeft_y = GetLongVal(objstring,&pos);
	
	// bottom right.x
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE; 
		goto FAILED;
	}
	AcRect_BottomRight_x = GetLongVal(objstring,&pos);
	
	// bottom right.y
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	AcRect_BottomRight_y = GetLongVal(objstring,&pos);
	
	// str.Format("%d,",m_nID);
	index = GetIndexInformation(objstring,&pos);
	if(index._Type!=0)  {
		nReturn = FALSE;
		goto FAILED;
	}
	nID = GetLongVal(objstring,&pos);

	// ridus.
	index= GetIndexInformation(objstring,&pos);
	nRisus = 0;
	if(index._Type==0) 
	{ 		
		nRisus = GetLongVal(objstring,&pos);
	}

	// ActiveframeStyle.
	index = GetIndexInformation(objstring,&pos);
	nFrameSytle = 0;
	if(index._Type==0) 
	{ 	
		nFrameSytle = GetLongVal(objstring,&pos);
	}

	// ActiveFrameContrans.
	index = GetIndexInformation(objstring,&pos);
	nFrameContrans = 0;
	if(index._Type==0) 
	{ 
		nFrameContrans = GetLongVal(objstring,&pos);
	}
	
	
	border_pointer = Border_Initialize2(
		Position_left,
		Position_top,
		Position_right,
		Position_bottom,
		eShape,
		eBackStyle,	
		AcText_szContent,	
		AcText_LOG_FONT,	
		AcText_bFring,		
		AcText_eLocation,
		AcText_dwTextColor,
		AcRect_dwFaceColor,
		AcRect_dwFrameColor,
		AcRect_eFrameThick,
		AcRect_eFaceStyle,
		AcRect_TopLeft_x,
		AcRect_TopLeft_y,
		AcRect_BottomRight_x,
		AcRect_BottomRight_y,
		nID,
		nRisus,
		nFrameSytle,
		nFrameContrans,
		g_page
		);
	if(level == 0  && page_pointer && border_pointer)
		page_add_border(page_pointer,border_pointer);
	else if(level == 1 && subpage_pointer && border_pointer)
		page_add_border(subpage_pointer,border_pointer);
	
FAILED:
	if(AcText_szContent)
		free (AcText_szContent);
	if(AcText_LOG_FONT)
		free (AcText_LOG_FONT);
	

	return nReturn;
}



Border* Border_Initialize2(
			int Position_left,
			int Position_top,
			int Position_right,
			int Position_bottom,
			eShape eShape,	
			eBack_Style eBackStyle,	
			STRING AcText_szContent,	
			LOG_FONT AcText_LOG_FONT,	
			BOOL AcText_bFring,		
			eLocation AcText_eLocation,
			COLORREF AcText_dwTextColor,
			
			COLORREF AcRect_dwFaceColor,
			COLORREF AcRect_dwFrameColor,
			eFrame AcRect_eFrameThick,
			eFace_Style AcRect_eFaceStyle,
			int AcRect_TopLeft_x,
			int AcRect_TopLeft_y,
			int AcRect_BottomRight_x,
			int AcRect_BottomRight_y,
			int nID,
			int nRisus,
			int nFrameSytle,
			int nFrameContrans,
			Page* gpage
			)
{

			Rect Position;
			TextItem AcText,InAcText;
			Point AcRect_BottomRight,AcRect_TopLeft,InAcRect_BottomRight,InAcRect_TopLeft;
			RectItem AcRect,InAcRect;

			if(!(Position_right-Position_left)%2) Position_right+=1;
			if(!(Position_bottom-Position_top)%2) Position_bottom+=1;

			
	
			Position = rect_struct_init(Position_bottom,Position_left,Position_right,Position_top);
			
			AcText = text_struct_init(AcText_szContent,AcText_LOG_FONT,AcText_bFring,AcText_eLocation,AcText_dwTextColor);

			InAcText = text_struct_init(NULL,NULL,0,0,0);

			AcRect_BottomRight = point_struct_init(AcRect_BottomRight_x,AcRect_BottomRight_y);
			AcRect_TopLeft = point_struct_init(AcRect_TopLeft_x,AcRect_TopLeft_y);
			AcRect = rectitem_struct_init2(AcRect_dwFaceColor,AcRect_dwFrameColor,AcRect_eFrameThick,AcRect_eFaceStyle,AcRect_TopLeft,AcRect_BottomRight,nFrameSytle,nFrameContrans);

			InAcRect_BottomRight = point_struct_init(-1,-1);
			InAcRect_TopLeft = point_struct_init(-1,-1);
			InAcRect = rectitem_struct_init2(0,0,0,0,InAcRect_TopLeft,InAcRect_BottomRight,nFrameSytle,nFrameContrans);

			return border_struct_init2(Position,eShape,eBackStyle,AcText,InAcText,AcRect,InAcRect,
				nID, nRisus,gpage);
			
}

Border*  border_struct_init2(				
			Rect Position,

			eShape eShape,
			eBack_Style eBackStyle,
			TextItem ActiveText,

			TextItem InActiveText,

			RectItem ActiveRect,

			RectItem  InActiveRect,
			
			int nID,
			int nRisus,

			Page* gpage
		)
{
	Border* p_border;
	int slen;

	p_border= (Border*)malloc(sizeof(Border));
	if(0 == p_border)
		return 0;
	memset(p_border,0,sizeof(Border));

	if(ActiveText.m_szContent == NULL)
		slen=0 ;
	else
		slen = strlen(ActiveText.m_szContent);

	if (slen !=0){

		p_border->m_tiActiveText.m_szContent = (STRING)malloc(slen+1);
		if( 0 == p_border->m_tiActiveText.m_szContent)
			return 0;
		strcpy(p_border->m_tiActiveText.m_szContent,ActiveText.m_szContent);
	}
	else
		p_border->m_tiActiveText.m_szContent = NULL;

	if(ActiveText.m_szContent)
		free(ActiveText.m_szContent);

	// add.
	p_border->m_tiActiveText.m_bFring = ActiveText.m_bFring;
	p_border->m_tiActiveText.m_ulTextColor = ActiveText.m_ulTextColor;
	p_border->m_tiActiveText.m_eLocation = ActiveText.m_eLocation;

	if(ActiveText.m_LogFont == NULL)
		slen = 0;
	else
		slen = strlen (ActiveText.m_LogFont);

	if(slen !=0)
	{
		p_border->m_tiActiveText.m_LogFont = (STRING) malloc(slen +1);
		if( 0 == p_border->m_tiActiveText.m_LogFont)
		{
			border_free_resource(p_border);
			return 0;
		}
		strcpy(p_border->m_tiActiveText.m_LogFont,ActiveText.m_LogFont);
	}
	else
		p_border->m_tiActiveText.m_LogFont = NULL;

	if(ActiveText.m_LogFont)
		free(ActiveText.m_LogFont);

	p_border->m_grBorderID = 0;

	p_border->m_eBackStyle = eBackStyle;

	p_border->m_eShape = eShape;

	p_border->m_riActiveRect = ActiveRect;
//	p_border->m_riInActiveRect = InActiveRect;

	p_border->m_nID  = nID;

	p_border->m_rPosition  = Position;
	p_border->nRisus = nRisus;

	p_border->gpage =gpage;

	return p_border;

⌨️ 快捷键说明

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