Console spreadsheet для PascalABC.Net: различия между версиями
Содержимое удалено Содержимое добавлено
→К переименованию: Использован шаблон. |
Нет описания правки |
||
Строка 15:
<source lang="Pascal">
// код не изменять, сам его писал
//Unit Console_spreadsheet
//Interface
uses
CRT;
var
Graph_color, Graph_mode: string;
Start3, current_X_ceil_adress, current_Y_ceil_adress, start2, start, spreadsheet_max_size_X: integer;
spreadsheet_max_size_Y: integer;
symbol: string;
grid: boolean;
Max_value_in_column, SHIFT, current_spreadsheet_column_size: integer;
current_spreadsheet_ceil_string_coordinate: integer;
current_spreadsheet_ceil_column_coordinate:integer ;
current_spreadsheet_background_color: string;
current_spreadsheet_ceil_content, current_spreadsheet_border_color, current_spreadsheet_text_color: string;
string_spreadsheet: array[0..80, 0..80] of string;
Max_values_in_spreadsheet: array[0..80] of integer;
spreadsheet_type: string;
procedure
begin
if (current_spreadsheet_background_color = 'red') then CRT.TextBackground(red);
if (current_spreadsheet_background_color = 'blue') then CRT.TextBackground(blue);
if (current_spreadsheet_background_color = 'yellow') then CRT.TextBackground(yellow);
if (current_spreadsheet_background_color = 'green') then CRT.TextBackground(green);
//if (current_spreadsheet_background_color='orange') then CRT.TextBackground(orange);
if (current_spreadsheet_background_color = 'black') then CRT.TextBackground(black);
if (current_spreadsheet_background_color = 'white') then CRT.TextBackground(white);
if (current_spreadsheet_background_color <> 'red') or (current_spreadsheet_background_color <> 'blue') or (current_spreadsheet_background_color <> 'yellow') or (current_spreadsheet_background_color <> 'green') or (current_spreadsheet_background_color <> 'orange') or (current_spreadsheet_background_color <> 'black') or (current_spreadsheet_background_color <> 'white') then begin CRT.TextBackground(white); CRT.TextColor(Black); WriteLn('Function parameter «Console_spreadsheet_set_baxkground» receives an invalid value.'); end;
end;
procedure Console_spreadsheet_set_text_color(Console_spreadsheet_text_color: string);
begin
if (current_spreadsheet_text_color <> 'red') or (current_spreadsheet_text_color <> 'blue') or (current_spreadsheet_text_color <> 'yellow') or (current_spreadsheet_text_color <> 'green') or (current_spreadsheet_text_color <> 'orange') or (current_spreadsheet_text_color <> 'black') or (current_spreadsheet_text_color <> 'white') then begin CRT.TextBackground(white); CRT.TextColor(Black);WriteLn('Function parameter «Console_spreadsheet_set_text_color» receives an invalid value.'); end;
procedure Console_spreadsheet_set_border_color(current_spreadsheet_border_color: string);
begin
if (current_spreadsheet_border_color <> 'red') or (current_spreadsheet_border_color <> 'blue') or (current_spreadsheet_border_color <> 'yellow') or (current_spreadsheet_border_color <> 'green') or (current_spreadsheet_border_color <> 'orange') or (current_spreadsheet_border_color <> 'black') or (current_spreadsheet_border_color <> 'white') then begin CRT.TextBackground(white); CRT.TextColor(Black); WriteLn('Function parameter «Console_spreadsheet_set_border_color» receives an invalid value.'); end;
procedure Console_spreadsheet_hide_grid();
begin
grid := false;
procedure Console_spreadsheet_show_grid();
begin
grid := true;
end;
{procedure Console_spreadsheet_adding_values_method_SHIFT(SHIFT: integer; symbol: string);
begin
Method := 1;
end;}
procedure Console_spreadsheet_set_size_for_X_axis(spreadsheet_max_size_X: integer);
begin
end;
procedure Console_spreadsheet_set_size_for_Y_axis(spreadsheet_max_size_Y: integer);
begin
end;
procedure Console_spreadsheet_set_ceil_content(current_spreadsheet_ceil_string_coordinate: integer; current_spreadsheet_ceil_column_coordinate: integer; current_spreadsheet_ceil_content: string);// доделать
begin
if (current_spreadsheet_ceil_string_coordinate > spreadsheet_max_size_X) or (current_spreadsheet_ceil_column_coordinate > spreadsheet_max_size_Y) then
begin
CRT.TextBackground(white); CRT.TextColor(Black); WriteLn('The cell is outside the table.');
end
Else
begin
string_spreadsheet[current_spreadsheet_ceil_string_coordinate, current_spreadsheet_ceil_column_coordinate] := current_spreadsheet_ceil_content;
end;
current_spreadsheet_ceil_string_coordinate := 0;
current_spreadsheet_ceil_column_coordinate := 0;
// сбор макс. значений таблицы в столбцах
// begin
for var start := 1 to spreadsheet_max_size_X do
begin
for var start2 := 1 to spreadsheet_max_size_Y do
begin
if (string_spreadsheet[current_spreadsheet_ceil_string_coordinate, current_spreadsheet_ceil_column_coordinate] > Max_value_in_column) then begin Max_value_in_column := string_spreadsheet[current_spreadsheet_ceil_string_coordinate, current_spreadsheet_ceil_column_coordinate]; current_spreadsheet_ceil_column_coordinate := current_spreadsheet_ceil_column_coordinate + 1; end else begin current_spreadsheet_ceil_column_coordinate := current_spreadsheet_ceil_column_coordinate + 1; end;
end;
Max_values_in_spreadsheet[current_spreadsheet_ceil_string_coordinate] := Max_value_in_column;
current_spreadsheet_ceil_string_coordinate := current_spreadsheet_ceil_string_coordinate + 1;
end;
// end
// вывод таблицы
current_spreadsheet_ceil_string_coordinate := 0;
current_spreadsheet_ceil_column_coordinate := 0;
for start := 1 to spreadsheet_max_size_Y do
begin
// тут остановился
for start2 := 1 to spreadsheet_max_size_X do
begin// здесь
// назначение цвета для вывода значния ячейки
if (current_spreadsheet_text_color = 'red') then CRT.TextColor(red);
if (current_spreadsheet_text_color = 'blue') then CRT.TextColor(blue);
if (current_spreadsheet_text_color = 'yellow') then CRT.TextColor(yellow);
if (current_spreadsheet_text_color = 'green') then CRT.TextColor(green);
if (current_spreadsheet_text_color = 'orange') then CRT.TextColor(orange);
if (current_spreadsheet_text_color = 'black') then CRT.TextColor(black);
if (current_spreadsheet_text_color = 'white') then CRT.TextColor(white);
// назначение цвета для вывода значния ячейки - end
// вывод значения ячейки
Write(string_spreadsheet[current_spreadsheet_ceil_string_coordinate, current_spreadsheet_ceil_column_coordinate]);
// вывод значения ячейки
// вывод пробелов до столбца
for start3 := 1 to Max_values_in_spreadsheet[current_spreadsheet_ceil_string_coordinate] do
begin
Write(' ');
end;
// вывод пробелов до столбца - end
// установка цвета столбца
if (current_spreadsheet_border_color = 'red') then CRT.TextColor(red);
if (current_spreadsheet_border_color = 'blue') then CRT.TextColor(blue);
if (current_spreadsheet_border_color = 'yellow') then CRT.TextColor(yellow);
if (current_spreadsheet_border_color = 'green') then CRT.TextColor(green);
if (current_spreadsheet_border_color = 'orange') then CRT.TextColor(orange);
if (current_spreadsheet_border_color = 'black') then CRT.TextColor(black);
if (current_spreadsheet_border_color = 'white') then CRT.TextColor(white);
// установка цвета столбца - end
Write('|');
current_spreadsheet_ceil_string_coordinate := current_spreadsheet_ceil_string_coordinate + 1;
end;
// вывод линейки
for start3 := 1 to spreadsheet_max_size_X do
begin
for start4 := 1 to Max_values_in_spreadsheet[current_spreadsheet_ceil_string_coordinate] do
begin
Write('-');
end;
Write('+');
end;
// вывод линейки - end
// Переход к следующей строке
current_spreadsheet_ceil_column_coordinate := current_spreadsheet_ceil_column_coordinate + 1;
end;
end;
procedure Console_spreadsheet_condition();
begin
// определить параметры, и доделать потом
end;
begin
Console_spreadsheet_set_size_for_Y_axis(10);
Console_spreadsheet_set_size_for_Y_axis(5);
end.
</source>
|