$MACRO_FILE BRIEF;
{******************************************************************************
														MULTI-EDIT MACRO FILE

Name:		BRIEF

Description:  This macro emulates a subset of the B.R.I.E.F. editor.

							 (C) Copyright 1988 by American Cybernetics, Inc.
******************************************************************************}

$MACRO SRC_CASE TRANS;
{Mimics BRIEF's Search_Case macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('I',Global_Str('Switches'),1);
	IF (Return_Int) THEN
		Set_Global_Str('Switches',Str_Del(Global_Str('Switches'),Return_Int,1));
	ELSE
		Set_Global_Str('Switches',Global_Str('Switches') + 'I');
	END;
END_MACRO;

$MACRO DELETE_M TRANS;
{Mimics BRIEF's Delete_Macro macro
The only difference being that BRIEF can only delete entire macro files from
memory, ME can delete individual macros}
	Def_Str(Temp_String);

	Temp_String := '';
	Put_Box(3,2,43,5,0,m_b_color,'',true);
	If String_In(Temp_String,'Macro to unload:  ', 16, 5, 3,'MC') THEN
		UnLoad_Macro(Temp_String);
	END;
	Kill_Box;
END_MACRO;

$MACRO TO_BOTTO TRANS;
{Mimics BRIEF's To_Bottom macro}
	Def_Int(Temp_Integer);
	Temp_Integer := C_Line;
	Run_Macro('BOTWIN');
	Goto_Line(Temp_Integer);
	Redraw;
END_MACRO;

$MACRO TO_TOP TRANS;
{Mimics BRIEF's To_Top macro}
	Def_Int(Temp_Integer);
	Temp_Integer := C_Line;
	Run_Macro('TOPWIN');
	Goto_Line(Temp_Integer);
	Redraw;
END_MACRO;

$MACRO OPEN_LIN TRANS;
{Mimics BRIEF's Open_Line macro}
	Def_Int(Temp_Insert_Mode);
	Temp_Insert_Mode := Insert_Mode;
	Insert_Mode := True;
	Eol;
	Cr;
	Insert_Mode := Temp_Insert_Mode;
END_MACRO;

$MACRO NEXT_ERR TRANS;
{Mimics BRIEF's Next_Error 1 macro}
	Def_Int(Temp_Integer);
	Temp_Integer := Cur_Window;
	Refresh := False;
	Switch_Window(Cur_Window + 1);
	WHILE ((Cur_Window <> Temp_Integer) and (Caps(Truncate_Path(File_Name)) <> (user_id + 'MEERR.TMP'))) DO
		Switch_Window(Cur_Window + 1);
	END;
	Refresh := True;
	Redraw;
END_MACRO;

$MACRO QUOTE TRANS;
{Mimics BRIEF's Quote macro}
	Read_Key;
	IF (Key1 <> 0) THEN
		Text(Char(Key1));
	ELSE
		Pass_Key(Key1,Key2);
	END;
END_MACRO;

$MACRO TOGGLE_R TRANS;
{Mimics BRIEF's Toggle_Re macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('X',Global_Str('Switches'),1);
	IF (Return_Int) THEN
		Set_Global_Str('Switches',Str_Del(Global_Str('Switches'),Return_Int,1));
	ELSE
		Set_Global_Str('Switches',Global_Str('Switches') + 'X');
	END;
END_MACRO;

$MACRO SEARCH_A TRANS;
{Mimics BRIEF's Search_Again macro}
	SET_GLOBAL_INT('SEARCH_MODE',0);
	SET_GLOBAL_INT('REPSEARCH',1);
	Run_Macro('MEUTIL2^S_AND_R');
END_MACRO;

$MACRO SEARCH_B TRANS;
{Mimics BRIEF's Search_Back macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('B',Global_Str('Switches'),1);
	IF (Return_Int = 0) THEN
		Set_Global_Str('Switches',Global_Str('Switches') + 'B');
	END;
	SET_GLOBAL_INT('SEARCH_MODE',0);
	Run_Macro('MEUTIL2^S_AND_R');
	SET_GLOBAL_INT('REPSEARCH',0);
END_MACRO;

$MACRO SEARCH_F TRANS;
{Mimics BRIEF's Search_Fwd macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('B',Global_Str('Switches'),1);
	IF (Return_Int) THEN
		Set_Global_Str('Switches',Str_Del(Global_Str('Switches'),Return_Int,1));
	END;
	SET_GLOBAL_INT('SEARCH_MODE',0);
	Run_Macro('MEUTIL2^S_AND_R');
	SET_GLOBAL_INT('REPSEARCH',0);
END_MACRO;

$MACRO XLAT_AGA TRANS;
{Mimics BRIEF's Translate_Again macro}
	SET_GLOBAL_INT('SEARCH_MODE',1);
	SET_GLOBAL_INT('REPSEARCH',1);
	Run_Macro('MEUTIL2^S_AND_R');
END_MACRO;

$MACRO XLAT_BWD TRANS;
{Mimics BRIEF's Translate_Back macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('B',Global_Str('Switches'),1);
	IF (Return_Int = 0) THEN
		Set_Global_Str('Switches',Global_Str('Switches') + 'B');
	END;
	SET_GLOBAL_INT('SEARCH_MODE',1);
	SET_GLOBAL_INT('REPSEARCH',0);
	Run_Macro('MEUTIL2^S_AND_R');
END_MACRO;

$MACRO TRANSLAT TRANS;
{Mimics BRIEF's Translate macro}
	Set_Global_Str('Switches',Caps(Global_Str('Switches')));
	Return_Int := XPos('B',Global_Str('Switches'),1);
	IF (Return_Int) THEN
		Set_Global_Str('Switches',Str_Del(Global_Str('Switches'),Return_Int,1));
	END;
	SET_GLOBAL_INT('SEARCH_MODE',1);
	SET_GLOBAL_INT('REPSEARCH',0);
	Run_Macro('MEUTIL2^S_AND_R');
END_MACRO;

$MACRO WRITE_IT TRANS;
{Mimics BRIEF's Write_It macro}
	IF (Block_Stat) THEN
		Run_Macro( 'MEUTIL1^SAVEBLOCK' );
	ELSE
		Run_Macro( 'MEUTIL1^SAVEFILE' );
	END;
END_MACRO;