[A] Added new style
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								docs/images/color_table.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/images/color_table.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 38 KiB  | 
@@ -152,7 +152,7 @@ void colorfull_table(void)
 | 
			
		||||
    setlocale(LC_CTYPE, "");
 | 
			
		||||
 | 
			
		||||
    ft_table_t *table = ft_create_table();
 | 
			
		||||
    ft_set_border_style(table, FT_DOUBLE_STYLE);
 | 
			
		||||
    ft_set_border_style(table, FT_NICE_STYLE);
 | 
			
		||||
    ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
 | 
			
		||||
 | 
			
		||||
    /* Filling table with data */
 | 
			
		||||
@@ -170,7 +170,6 @@ void colorfull_table(void)
 | 
			
		||||
    ft_set_cell_span(table, 8, 0, 4);
 | 
			
		||||
    ft_wwrite_ln(table, L"Total result", L"", L"", L"", L"✖");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* Setting text styles */
 | 
			
		||||
    ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
 | 
			
		||||
    ft_set_cell_prop(table, 8, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
 | 
			
		||||
@@ -178,7 +177,6 @@ void colorfull_table(void)
 | 
			
		||||
    ft_set_cell_prop(table, FT_ANY_ROW, 4, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_BOLD);
 | 
			
		||||
    ft_set_cell_prop(table, FT_ANY_ROW, FT_ANY_COLUMN, FT_CPROP_CONT_TEXT_STYLE, FT_TSTYLE_ITALIC);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* Set alignment */
 | 
			
		||||
    ft_set_cell_prop(table, FT_ANY_ROW, 1, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
 | 
			
		||||
    ft_set_cell_prop(table, FT_ANY_ROW, 2, FT_CPROP_TEXT_ALIGN, FT_ALIGNED_RIGHT);
 | 
			
		||||
@@ -195,9 +193,13 @@ void colorfull_table(void)
 | 
			
		||||
    ft_set_cell_prop(table, 4, 3, FT_CPROP_CONT_BG_COLOR, FT_COLOR_LIGHT_RED);
 | 
			
		||||
    ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_CONT_FG_COLOR, FT_COLOR_LIGHT_BLUE);
 | 
			
		||||
 | 
			
		||||
    /* Move table to the center of the screen */
 | 
			
		||||
    ft_set_tbl_prop(table, FT_TPROP_TOP_MARGIN, 1);
 | 
			
		||||
    ft_set_tbl_prop(table, FT_TPROP_LEFT_MARGIN, 10);
 | 
			
		||||
 | 
			
		||||
    const wchar_t *table_wstr = ft_to_wstring(table);
 | 
			
		||||
    if (table_wstr) {
 | 
			
		||||
        fwprintf(stderr, L"Table:\n%ls\n ", table_wstr);
 | 
			
		||||
        fwprintf(stderr, L"Table:\n%ls\n\n ", table_wstr);
 | 
			
		||||
    } else {
 | 
			
		||||
        fwprintf(stderr, L"Table conversion failed !!!\n ");
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								lib/fort.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								lib/fort.c
									
									
									
									
									
								
							@@ -535,6 +535,7 @@ extern struct fort_border_style FORT_DOT_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_EMPTY_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_SOLID_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_NICE_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_DOUBLE_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_DOUBLE2_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_BOLD_STYLE;
 | 
			
		||||
@@ -1490,8 +1491,7 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
 | 
			
		||||
    },                            \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DOUBLE_STYLE  {           \
 | 
			
		||||
#define NICE_STYLE  {             \
 | 
			
		||||
    /* border_chars */            \
 | 
			
		||||
    {                             \
 | 
			
		||||
     "╔", "═", "╦", "╗",          \
 | 
			
		||||
@@ -1510,11 +1510,37 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
 | 
			
		||||
    },                            \
 | 
			
		||||
    /* separator_chars */         \
 | 
			
		||||
    {                             \
 | 
			
		||||
    "╠", "═", "╬", "╣",           \
 | 
			
		||||
    "╦", "╩",                     \
 | 
			
		||||
    "╟", "─", "╫", "╢",           \
 | 
			
		||||
    "╥", "╨",                     \
 | 
			
		||||
    },                            \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define DOUBLE_STYLE  {         \
 | 
			
		||||
    /* border_chars */          \
 | 
			
		||||
    {                           \
 | 
			
		||||
     "╔", "═", "╦", "╗",        \
 | 
			
		||||
     "║", "║", "║",             \
 | 
			
		||||
     "", "", "", "",            \
 | 
			
		||||
     "╚", "═", "╩", "╝",        \
 | 
			
		||||
     "┣", "┻", "┣", "┳",        \
 | 
			
		||||
    },                          \
 | 
			
		||||
    /* header_border_chars */   \
 | 
			
		||||
    {                           \
 | 
			
		||||
    "╔", "═", "╦", "╗",         \
 | 
			
		||||
    "║", "║", "║",              \
 | 
			
		||||
    "╠", "═", "╬", "╣",         \
 | 
			
		||||
    "╚", "═", "╩", "╝",         \
 | 
			
		||||
    "┣", "╦", "┣", "╩",         \
 | 
			
		||||
    },                          \
 | 
			
		||||
    /* separator_chars */       \
 | 
			
		||||
    {                           \
 | 
			
		||||
    "╠", "═", "╬", "╣",         \
 | 
			
		||||
    "╦", "╩",                   \
 | 
			
		||||
    },                          \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DOUBLE2_STYLE  {          \
 | 
			
		||||
    /* border_chars */            \
 | 
			
		||||
@@ -1622,6 +1648,7 @@ struct fort_border_style FORT_DOT_STYLE = DOT_STYLE;
 | 
			
		||||
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
 | 
			
		||||
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
 | 
			
		||||
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
 | 
			
		||||
struct fort_border_style FORT_NICE_STYLE = NICE_STYLE;
 | 
			
		||||
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
 | 
			
		||||
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
 | 
			
		||||
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
 | 
			
		||||
@@ -2919,6 +2946,7 @@ struct ft_border_style *FT_DOT_STYLE = (struct ft_border_style *) &FORT_DOT_STYL
 | 
			
		||||
struct ft_border_style *FT_EMPTY_STYLE  = (struct ft_border_style *) &FORT_EMPTY_STYLE;
 | 
			
		||||
struct ft_border_style *FT_SOLID_STYLE  = (struct ft_border_style *) &FORT_SOLID_STYLE;
 | 
			
		||||
struct ft_border_style *FT_SOLID_ROUND_STYLE  = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
 | 
			
		||||
struct ft_border_style *FT_NICE_STYLE  = (struct ft_border_style *) &FORT_NICE_STYLE;
 | 
			
		||||
struct ft_border_style *FT_DOUBLE_STYLE  = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
 | 
			
		||||
struct ft_border_style *FT_DOUBLE2_STYLE  = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
 | 
			
		||||
struct ft_border_style *FT_BOLD_STYLE  = (struct ft_border_style *) &FORT_BOLD_STYLE;
 | 
			
		||||
@@ -2937,6 +2965,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_EMPTY_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_SOLID_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_NICE_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_BOLD_STYLE
 | 
			
		||||
 
 | 
			
		||||
@@ -624,6 +624,7 @@ extern struct ft_border_style *FT_DOT_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_EMPTY_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_SOLID_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_SOLID_ROUND_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_NICE_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_DOUBLE_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_DOUBLE2_STYLE;
 | 
			
		||||
extern struct ft_border_style *FT_BOLD_STYLE;
 | 
			
		||||
 
 | 
			
		||||
@@ -836,6 +836,7 @@ struct ft_border_style *FT_DOT_STYLE = (struct ft_border_style *) &FORT_DOT_STYL
 | 
			
		||||
struct ft_border_style *FT_EMPTY_STYLE  = (struct ft_border_style *) &FORT_EMPTY_STYLE;
 | 
			
		||||
struct ft_border_style *FT_SOLID_STYLE  = (struct ft_border_style *) &FORT_SOLID_STYLE;
 | 
			
		||||
struct ft_border_style *FT_SOLID_ROUND_STYLE  = (struct ft_border_style *) &FORT_SOLID_ROUND_STYLE;
 | 
			
		||||
struct ft_border_style *FT_NICE_STYLE  = (struct ft_border_style *) &FORT_NICE_STYLE;
 | 
			
		||||
struct ft_border_style *FT_DOUBLE_STYLE  = (struct ft_border_style *) &FORT_DOUBLE_STYLE;
 | 
			
		||||
struct ft_border_style *FT_DOUBLE2_STYLE  = (struct ft_border_style *) &FORT_DOUBLE2_STYLE;
 | 
			
		||||
struct ft_border_style *FT_BOLD_STYLE  = (struct ft_border_style *) &FORT_BOLD_STYLE;
 | 
			
		||||
@@ -854,6 +855,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_EMPTY_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_SOLID_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_SOLID_ROUND_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_NICE_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_DOUBLE_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_DOUBLE2_STYLE
 | 
			
		||||
        || (struct fort_border_style *)style == &FORT_BOLD_STYLE
 | 
			
		||||
 
 | 
			
		||||
@@ -696,8 +696,7 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
 | 
			
		||||
    },                            \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DOUBLE_STYLE  {           \
 | 
			
		||||
#define NICE_STYLE  {             \
 | 
			
		||||
    /* border_chars */            \
 | 
			
		||||
    {                             \
 | 
			
		||||
     "╔", "═", "╦", "╗",          \
 | 
			
		||||
@@ -716,11 +715,37 @@ fort_status_t set_default_cell_property(uint32_t property, int value)
 | 
			
		||||
    },                            \
 | 
			
		||||
    /* separator_chars */         \
 | 
			
		||||
    {                             \
 | 
			
		||||
    "╠", "═", "╬", "╣",           \
 | 
			
		||||
    "╦", "╩",                     \
 | 
			
		||||
    "╟", "─", "╫", "╢",           \
 | 
			
		||||
    "╥", "╨",                     \
 | 
			
		||||
    },                            \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define DOUBLE_STYLE  {         \
 | 
			
		||||
    /* border_chars */          \
 | 
			
		||||
    {                           \
 | 
			
		||||
     "╔", "═", "╦", "╗",        \
 | 
			
		||||
     "║", "║", "║",             \
 | 
			
		||||
     "", "", "", "",            \
 | 
			
		||||
     "╚", "═", "╩", "╝",        \
 | 
			
		||||
     "┣", "┻", "┣", "┳",        \
 | 
			
		||||
    },                          \
 | 
			
		||||
    /* header_border_chars */   \
 | 
			
		||||
    {                           \
 | 
			
		||||
    "╔", "═", "╦", "╗",         \
 | 
			
		||||
    "║", "║", "║",              \
 | 
			
		||||
    "╠", "═", "╬", "╣",         \
 | 
			
		||||
    "╚", "═", "╩", "╝",         \
 | 
			
		||||
    "┣", "╦", "┣", "╩",         \
 | 
			
		||||
    },                          \
 | 
			
		||||
    /* separator_chars */       \
 | 
			
		||||
    {                           \
 | 
			
		||||
    "╠", "═", "╬", "╣",         \
 | 
			
		||||
    "╦", "╩",                   \
 | 
			
		||||
    },                          \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define DOUBLE2_STYLE  {          \
 | 
			
		||||
    /* border_chars */            \
 | 
			
		||||
@@ -828,6 +853,7 @@ struct fort_border_style FORT_DOT_STYLE = DOT_STYLE;
 | 
			
		||||
struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
 | 
			
		||||
struct fort_border_style FORT_SOLID_STYLE = SOLID_STYLE;
 | 
			
		||||
struct fort_border_style FORT_SOLID_ROUND_STYLE = SOLID_ROUND_STYLE;
 | 
			
		||||
struct fort_border_style FORT_NICE_STYLE = NICE_STYLE;
 | 
			
		||||
struct fort_border_style FORT_DOUBLE_STYLE = DOUBLE_STYLE;
 | 
			
		||||
struct fort_border_style FORT_DOUBLE2_STYLE = DOUBLE2_STYLE;
 | 
			
		||||
struct fort_border_style FORT_BOLD_STYLE = BOLD_STYLE;
 | 
			
		||||
 
 | 
			
		||||
@@ -162,6 +162,7 @@ extern struct fort_border_style FORT_DOT_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_EMPTY_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_SOLID_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_SOLID_ROUND_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_NICE_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_DOUBLE_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_DOUBLE2_STYLE;
 | 
			
		||||
extern struct fort_border_style FORT_BOLD_STYLE;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user