image thumbnail
from Semitic_to_Arabic by GAMAL ALKIRSHI
Program's Name: Semitic to Arabic

mainfunction
function mainfunction

clear all;close all;clc;delete('*.asv');

global Cstor Cnum TextStore NScriptCrecter StoreCrecterUsesOfScript NumberOfCharacter FSTS_store ETB_store ScriptStore Cacv FntMS FntM ACV CurentFont NES NLsym

CDr=pwd;

SSize=[1,1,1280,800];
%SSize=get(0,'ScreenSize');
figpos=[5/40*SSize(3) 5/40*SSize(4) 30/40*SSize(3) 30/40*SSize(4)];
fig=figure('Name','Semitic to Arabic','numbertitle','off','menubar','none','color',[0 0 0],...
    'units','pixels','position',figpos,'resize','off','DockControls','off');
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


%**************************************
%Intialization Parameters
%**************************************
[TextType, oni, NumberOfCharacter, FntMc, NLsym, ACVoS, ACVaS,...
    ACV, FntMa, FntMb, FntNL, FntNa, ScrNa, FntM, FntMS, AdMS, CurentFont,...
    NES, lLs, rLs, npk]=LoadIntializationParameters(CDr);

[Cstor,Cnum,TextStore,NScriptCrecter,StoreCrecterUsesOfScript,FSTS_store,ETB_store,ScriptStore,Cacv]=StartParameter;
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


%**************************************
%Panels--Panels--Panels--Panels--Panels
%**************************************

%
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%
posa1=posXY(fig,0/40,0/40,40/40,17.5/40);
FPanA1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedout');
posa1=posXY(FPanA1,0/40,1.5/40,5.7/40,38.5/40);
FPanA11=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanA1,0/40,2.5/40,5.4/40,36.5/40);
FPanA11=uipanel('units','pixels','backgroundcolor',[1 0 0],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>

posa1=posXY(FPanA1,34.3/40,1.5/40,5.7/40,38.5/40);
FPanA11=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanA1,34.6/40,2.5/40,5.4/40,36.5/40);
FPanA11=uipanel('units','pixels','backgroundcolor',[1 0 0],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>


posa1=posXY(fig,0/40,39/40,40/40,1/40);
FPanAu1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedout');
posa1=posXY(FPanAu1,0/40,0/40,5.1/40,20/40);
FPanAu11=uipanel('units','pixels','backgroundcolor',[1 0 0],'parent',FPanAu1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanAu1,34.9/40,0/40,5.1/40,20/40);
FPanAu11=uipanel('units','pixels','backgroundcolor',[1 0 0],'parent',FPanAu1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanAu1,5.7/40,10/40,28.6/40,30/40);
FPanAu11=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanAu1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanAu11,10/40,0/40,20/40,40/40);
FPanAu111=uicontrol('units','pixels','parent',FPanAu11,'foregroundcolor',[0 0 0],'position',posa1); %#ok<NASGU>
%
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%
%--------------------------------------
%Lower Panel
%--------------------------------------
pos1=posXY(fig,6/40,2/40,28/40,15/40);
FPan1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',fig,'foregroundcolor',[0 0 0],'position',pos1);

%--------------------------------------
%Upper Panel
%--------------------------------------
pos=posXY(fig,5/40,28/40,30/40,11/40);
FPan2=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',fig,'foregroundcolor',[0 0 0],'position',pos,'bordertype','etchedout');
pos=posXY(FPan2,0.001,0.001,0.995,0.97);
FPan22=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPan2,'foregroundcolor',[0 0 0],'position',pos,'bordertype','etchedin');
%--------------------------------------
%
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%
posa1=posXY(fig,4/40,2/40,1.1/40,37/40);
FPanA1=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA1,10/40,2/40,15/40,36/40);
FPanA1R1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA1R1,0/40,0/40,40/40,15/40);
FPanA12=uicontrol('units','pixels','style','pushbutton','parent',FPanA1R1,'position',posa1); %#ok<NASGU>
posa1=posXY(FPanA1R1,0/40,25/40,40/40,15/40);
FPanA13=uicontrol('units','pixels','style','pushbutton','parent',FPanA1R1,'position',posa1); %#ok<NASGU>

posa1=posXY(fig,35/40,2/40,1/40,37/40);
FPanA2=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA2,10/40,2/40,15/40,36/40);
FPanA2L1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA2L1,0/40,0/40,40/40,15/40);
FPanA22=uicontrol('units','pixels','style','pushbutton','parent',FPanA2L1,'position',posa1); %#ok<NASGU>
posa1=posXY(FPanA2L1,0/40,25/40,40/40,15/40);
FPanA23=uicontrol('units','pixels','style','pushbutton','parent',FPanA2L1,'position',posa1); %#ok<NASGU>

posa1=posXY(fig,0/40,2/40,1.1/40,37/40);
FPanA1=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA1,10/40,2/40,15/40,36/40);
FPanA1RR1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA1,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA1RR1,0/40,0/40,40/40,15/40);
FPanA12=uicontrol('units','pixels','style','pushbutton','parent',FPanA1RR1,'position',posa1); %#ok<NASGU>
posa1=posXY(FPanA1RR1,0/40,25/40,40/40,15/40);
FPanA13=uicontrol('units','pixels','style','pushbutton','parent',FPanA1RR1,'position',posa1); %#ok<NASGU>

posa1=posXY(fig,39/40,2/40,1/40,37/40);
FPanA2=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA2,10/40,2/40,15/40,36/40);
FPanA2LL1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA2LL1,0/40,0/40,40/40,15/40);
FPanA22=uicontrol('units','pixels','style','pushbutton','parent',FPanA2LL1,'position',posa1); %#ok<NASGU>
posa1=posXY(FPanA2LL1,0/40,25/40,40/40,15/40);
FPanA23=uicontrol('units','pixels','style','pushbutton','parent',FPanA2LL1,'position',posa1); %#ok<NASGU>

posa1=posXY(fig,6/40,0/40,28/40,2/40);
FPanA2=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',fig,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin');
posa1=posXY(FPanA2,0/40,0/40,10/40,15/40);
FPanA21=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanA2,0/40,25/40,10/40,15/40);
FPanA21=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanA2,30/40,0/40,10/40,15/40);
FPanA21=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
posa1=posXY(FPanA2,30/40,25/40,10/40,15/40);
FPanA21=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posa1,'bordertype','etchedin'); %#ok<NASGU>
%
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%

%--------------------------------------
%Lowest Panel for Adding Symbol Buttons
%--------------------------------------
posASB=posXY(FPanA2,9/40,0/40,22/40,40/40);
symbols_pn1=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posASB,'bordertype','etchedin');
posASB=posXY(symbols_pn1,1/40,5/40,38/40,30/40);
symbols_pn2=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',symbols_pn1,'foregroundcolor',[0 0 0],'position',posASB,'bordertype','etchedin');
posASB=posXY(symbols_pn2,11/40,1/40,18/40,34/40);
symbols_pn=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',symbols_pn2,'foregroundcolor',[0 0 0],'position',posASB,'bordertype','line');
%--------------------------------------

%--------------------------------------
%Right Panel
%--------------------------------------
pos=posXY(fig,36/40,2/40,3/40,(17+22-2)/40);
FPanR=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',fig,'foregroundcolor',[0 0 0],'position',pos);

pos=posXY(FPanR,1/40,30/40,38/40,10/40);
FPanRu1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanR,...
    'foregroundcolor',[0 0 0],'position',pos);
pos=posXY(FPanRu1,1/40,1/40,38/40,38/40);
FPanRu=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanRu1,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','line');

pos=posXY(FPanR,1/40,10/40,38/40,20/40);
FPanRm1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanR,...
    'foregroundcolor',[0 0 0],'position',pos);

%---------------------------------------------------------vvvvvvvvvvvvvvvvv
for np=1:npk
    pos=posXY(FPanRm1,1/40,0.5/40,38/40,39/40);
    FPanRm(np)=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRm1,...
        'foregroundcolor',[0 0 0],'position',pos,'bordertype','line','visible','off'); %#ok<AGROW>
end

npkN=1;%The visible panel from setting panels
set(FPanRm(npkN),'visible','on');
%---------------------------------------------------------^^^^^^^^^^^^^^^^^

%Add, Substiution and delete buttons
%--------------------------------------
posm=posXY(FPanRm1,1/40,0/40,37/40,18/40);
FPanRmd_1=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',posm,'bordertype','line');
posm=posXY(FPanRmd_1,1/40,30/40,38/40,10/40);
FPanRmd_1_Char=uipanel('units','pixels','backgroundcolor',[0.9 1 0.9],'parent',FPanRmd_1,...
    'foregroundcolor',[0 0 0],'position',posm,'BorderType','etchedin');
posm=posXY(FPanRmd_1_Char,1/40,5/40,36/40,28/40);
FPanRmd_11_Char=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRmd_1_Char,...
    'foregroundcolor',[0 0 0],'position',posm,'BorderType','etchedin');

%Panels for New Line Button
%--------------------
posm=posXY(FPanRmd_1,1/40,20/40,38/40,10/40);
FPanRmd_2_NewLine=uipanel('units','pixels','backgroundcolor',[0.9 1 0.9],'parent',FPanRmd_1,...
    'foregroundcolor',[0 0 0],'position',posm,'BorderType','etchedin');
posm=posXY(FPanRmd_2_NewLine,1/40,5/40,36/40,28/40);
FPanRmd_21_NewLine=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRmd_2_NewLine,...
    'foregroundcolor',[0 0 0],'position',posm,'BorderType','etchedin');


posm=posXY(FPanRm1,1/40,0/40,37/40,18/40);
FPanRmd=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRm(2),...
    'foregroundcolor',[0 0 0],'position',posm,'bordertype','line');
pos=posXY(FPanRm1,1/40,36/40,36.5/40,4/40);
FPanRmu1=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin');
pos=posXY(FPanRmu1,0/40,0/40,23/40,40/40);
FPanRmu11=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu1,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','beveledin');
pos=posXY(FPanRmu1,25/40,0/40,15/40,40/40);
FPanRmu12=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu1,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','beveledin');

pos=posXY(FPanRm1,1/40,32/40,37/40,4/40);
FPanRmu2=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin');
pos=posXY(FPanRmu2,2/40,5/40,34/40,30/40);
FPanRmu22=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu2,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin');
pos=posXY(FPanRm1,1/40,31/40,36.5/40,1/40);
FPanRmu20=uipanel('units','pixels','backgroundcolor',[0.9 1 0.9],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin'); %#ok<NASGU>

pos=posXY(FPanRm1,1/40,26.5/40,36.5/40,4.5/40);
FPanRmu3=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin');

pos=posXY(FPanRm1,1/40,22/40,37/40,4/40);
FPanRmu5=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin','visible','on');
pos=posXY(FPanRmu5,2/40,5/40,34/40,30/40);
FPanRmu52=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu5,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin');
pos=posXY(FPanRm1,1/40,26/40,36.5/40,1/40);
FPanRmu50=uipanel('units','pixels','backgroundcolor',[0.9 1 0.9],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin'); %#ok<NASGU>

pos=posXY(FPanRm1,1/40,18/40,36.5/40,4/40);
FPanRmu4=uipanel('units','pixels','backgroundcolor',[1 1 0.7],'parent',FPanRm(1),...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','etchedin','visible','on');
pos=posXY(FPanRmu4,0/40,3/40,23/40,33/40);
FPanRmu41=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu4,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','beveledin');
pos=posXY(FPanRmu4,25/40,3/40,15/40,33/40);
FPanRmu42=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanRmu4,...
    'foregroundcolor',[0 0 0],'position',pos,'BorderType','beveledin');

pos=posXY(FPanR,1/40,0/40,38/40,10/40);
FPanRd1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanR,...
    'foregroundcolor',[0 0 0],'position',pos);
pos=posXY(FPanRd1,1/40,1/40,38/40,38/40);
FPanRd=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanRd1,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','line');
%--------------------------------------

%--------------------------------------
%Left Panel
%--------------------------------------
pos=posXY(fig,1/40,2/40,3/40,(17+22-2)/40);
FPanL=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',fig,'foregroundcolor',[0 0 0],'position',pos);

pos=posXY(FPanL,1/40,10/40,38/40,29.8/40);
FPanLu1=uipanel('units','pixels','backgroundcolor',[1 1 0],'parent',FPanL,'foregroundcolor',[0 0 0],'position',pos);
pos=posXY(FPanLu1,0,0,1,1);
FPanLu=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanLu1,'foregroundcolor',[0 0 0],'position',pos,'BorderType','line','visible','on');

pos=posXY(FPanL,1/40,0/40,38/40,10/40);
FPanLd1=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanL,...
    'foregroundcolor',[0 0 0],'position',pos);
pos=posXY(FPanLd1,1/40,1/40,38/40,38/40);
FPanLd=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanLd1,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','line');
%--------------------------------------

%--------------------------------------
%Mid Panel
%--------------------------------------
pos=posXY(fig,5/40,17.5/40,30/40,4/40);
FPanM=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',fig,'foregroundcolor',[0 0 0],'position',pos);

pos=posXY(fig,5/40,23.5/40,30/40,4/40);%To show translation with latin samples
FPanML=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',fig,'foregroundcolor',[0 0 0],'position',pos);

pos=posXY(fig,5/40,21.5/40,30/40,2/40);
FPanMLM=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',fig,...
    'foregroundcolor',[0 0 0],'position',pos);

pos=posXY(FPanMLM,1/30,12/30,28/30,6/30);
FPanMLMw=uipanel('units','pixels','backgroundcolor',[1 1 1],'parent',FPanMLM,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','line'); %#ok<NASGU>
pos=posXY(FPanMLM,1/30,18/30,28/30,12/30);
FPanMLMr=uipanel('units','pixels','backgroundcolor',[1 0 0],'parent',FPanMLM,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','etchedout'); %#ok<NASGU>
pos=posXY(FPanMLM,1/30,0/30,28/30,12/30);
FPanMLMb=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanMLM,...
    'foregroundcolor',[0 0 0],'position',pos,'bordertype','etchedout'); %#ok<NASGU>

posbt=posXY(FPanMLM,10/40,0/40,20/40,40/40);
FPanA2=uipanel('units','pixels','backgroundcolor',[1 1 0.75],'parent',FPanMLM,'foregroundcolor',[0 0 0],'position',posbt,'bordertype','etchedin');
posbt=posXY(FPanA2,1/40,3/40,38/40,34/40);
FPanA22=uipanel('units','pixels','backgroundcolor',[0 0 0],'parent',FPanA2,'foregroundcolor',[0 0 0],'position',posbt,'bordertype','etchedin');
posbt=posXY(FPanA22,2/40,3/40,36/40,30/40);
BTitle=uicontrol('units','pixels','style','text','parent',FPanA22,...
    'position',posbt,'string','Semitic Into Arabic','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'fontname','Times New Roman','FontWeight','bold','HorizontalAlignment','center','fontsize',14);
%--------------------------------------

%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

%**************************************
%Menubar-Menubar-Menubar-Menubar-Menubar
%**************************************

%--------------------------------------
%Menubar
%********************File
MF_Newt='New';
MF_Script_Typet='Script Type';
%-------------------
%MF_Script_Type1t='Mosnad';
%MF_Script_Type2t='Hebro';
%MF_Script_Type3t='Ga''azi';
%MF_Script_Type4t='Phoenician';
%MF_Script_Type5t='Thamudic';
%-------------------
MF_Loadt='Load';
MF_Savet='Save';
MF_Exitt='Exit';

MFmb1=uimenu('label','File');
MF_New=uimenu(MFmb1,'label',MF_Newt,'Callback',@MF_New_p,'Accelerator','N'); %#ok<NASGU>
%-------------------

MF_Script_Type=uimenu(MFmb1,'label',MF_Script_Typet,'Separator','on');
NOC=length(NumberOfCharacter);
for NNOC=1:NOC
    MF_Script_Name_St=cell2mat(ScrNa(NNOC));
    MF_Script_Name_S(NNOC)=uimenu(MF_Script_Type,'label',MF_Script_Name_St,'Callback',@MF_Script_Name_S_p); %#ok<AGROW>
    if NNOC==1
        set(MF_Script_Name_S(NNOC),'Checked','on');
    end
end

    function MF_Script_Name_S_p(MF_Script_Name_S,eventdata) %#ok<INUSD>
        NOC=length(NumberOfCharacter);
        S_N_Num=get(MF_Script_Name_S,'label');
        for NNOCC=1:NOC
            if isequal(S_N_Num,cell2mat(ScrNa(NNOCC)))
                S_N_Num=NNOCC;
            end
        end
    
        Script_Name_Num(S_N_Num);
    end
    function Script_Name_Num(S_N_Num)
        if get(SelectFontType,'value')~=S_N_Num
            set(MF_Script_Name_S,'Checked','off');
            set(MF_Script_Name_S(S_N_Num),'Checked','on');
            set(SelectFontType,'value',S_N_Num);
            SelectFontType_f(SelectFontType,[]);
        end
    end
%    function Script_Name_Num(S_N)
%        set(ME_Font_Size_S,'Checked','off');
%        set(ME_Font_Size_S(F_N_Size),'Checked','on');
%        set(SellectFontSize,'value',F_N_Size-1);
%        set(SellectFontSize_t,'string',num2str(F_N_Size+7));
%    end

%-------------------
MF_Load=uimenu(MFmb1,'label',MF_Loadt,'Callback',@MF_Load_p,'Accelerator','L','Separator','on'); %#ok<NASGU>
MF_Save=uimenu(MFmb1,'label',MF_Savet,'Callback',@MF_Save_p,'Accelerator','S','Separator','off'); %#ok<NASGU>
MF_Exit=uimenu(MFmb1,'label',MF_Exitt,'Callback',@MF_Exit_p,'Accelerator','Q','Separator','on'); %#ok<NASGU>


%********************Edit
ME_Editt='Edit';
ME_Restt='Rest';
ME_Cleart='Clear';
ME_Font_Sizet='Font Size';
ME_Cell_Sizet='Cell Size';

MFmb2=uimenu('label','Edit');
ME_Edit=uimenu(MFmb2,'label',ME_Editt,'Callback',@ME_Edit_p,'Accelerator','E'); %#ok<NASGU>
ME_Rest=uimenu(MFmb2,'label',ME_Restt,'Callback',@ME_Rest_p,'Accelerator','R','Separator','off'); %#ok<NASGU>
ME_Clear=uimenu(MFmb2,'label',ME_Cleart,'Callback',@ME_Clear_p,'Accelerator','X','Separator','off'); %#ok<NASGU>
ME_Font_Size=uimenu(MFmb2,'label',ME_Font_Sizet,'Separator','on');
for NBlock=1:11
    ME_Font_Size_St=num2str(NBlock+7);
    ME_Font_Size_S(NBlock)=uimenu(ME_Font_Size,'label',ME_Font_Size_St,'Callback',@ME_Font_Size_S_p); %#ok<AGROW>
    if NBlock+7==12
        set(ME_Font_Size_S(NBlock),'Checked','on');
    end
end
ME_Cell_Size=uimenu(MFmb2,'label',ME_Cell_Sizet,'Separator','off');
for NBlock=1:4
    ME_Cell_Size_St=num2str(NBlock);
    ME_Cell_Size_S(NBlock)=uimenu(ME_Cell_Size,'label',ME_Cell_Size_St,'Callback',@ME_Cell_Size_S_p); %#ok<AGROW>
    if NBlock==3
        set(ME_Cell_Size_S(NBlock),'Checked','on');
    end
end

%Menubar Functions
%********************File

%-------------------

%-------------------
    function MF_New_p(MF_New,eventdata) %#ok<INUSD>
        set(ClearButton,'value',1);
        ClearButton_p(ClearButton,[]);
        set(ClearButton,'value',0);
    end
    function MF_Load_p(MF_Load,eventdata) %#ok<INUSD>
        set(LoadButton,'value',1);
        LoadButton_p(LoadButton,[]);
        set(LoadButton,'value',0);
    end
    function MF_Save_p(MF_Save,eventdata) %#ok<INUSD>
        set(SaveButton,'value',1);
        SaveButton_p(SaveButton,[]);
        set(SaveButton,'value',0);
    end
    function MF_Exit_p(MF_Exit,eventdata) %#ok<INUSD>
        close all;
    end


%********************Edit

    function ME_Edit_p(ME_Edit,eventdata) %#ok<INUSD>
        set(EditButton,'value',1);
        EditButton_p(EditButton,[]);
        set(EditButton,'value',0);
    end
    function ME_Rest_p(ME_Rest,eventdata) %#ok<INUSD>
        set(RestButton,'value',1);
        RestButton_p(RestButton,[]);
        set(RestButton,'value',0);
    end
    function ME_Clear_p(ME_Clear,eventdata) %#ok<INUSD>
        set(ClearButton,'value',1);
        ClearButton_p(ClearButton,[]);
        set(ClearButton,'value',0);
    end
    function ME_Font_Size_S_p(ME_Font_Size_S,eventdata) %#ok<INUSD>
        F_N_Size=get(ME_Font_Size_S,'label');
        F_N_Size=str2double(char(F_N_Size));
        set(Cshow,'fontsize',F_N_Size);
        ApplyEditingInTranslation(TextType,ScriptStore);
        Font_Size_Num(F_N_Size-7);
    end
    function Font_Size_Num(F_N_Size)
        set(ME_Font_Size_S,'Checked','off');
        set(ME_Font_Size_S(F_N_Size),'Checked','on');
        set(SellectFontSize,'value',F_N_Size-1);
        set(SellectFontSize_t,'string',num2str(F_N_Size+7));
    end

    function ME_Cell_Size_S_p(ME_Cell_Size_S,eventdata) %#ok<INUSD>
        C_N_Size=get(ME_Cell_Size_S,'label');
        C_N_Size=str2double(char(C_N_Size));
        Cell_Size_Num(C_N_Size);
    end
    function Cell_Size_Num(C_N_Size)
        set(ME_Cell_Size_S,'Checked','off');
        set(ME_Cell_Size_S(C_N_Size),'Checked','on');
        set(SellectNumberOfCell_t,'string',num2str(C_N_Size));
        set(SellectNumberOfCell,'value',C_N_Size);
        set(NumberOfCellOk,'value',1);
        NumberOfCellOk_p(NumberOfCellOk,[]);
        set(NumberOfCellOk,'value',0);
        
    end

%--------------------------------------

%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

%**************************************
%Buttons--Buttons--Buttons--Buttons--Buttons
%**************************************

%--------------------------------------
%Input Buttons (Lower Panel)
%--------------------------------------
m=0;
for n=1:oni
    for j=1:oni
        m=m+1;
        pos2=posXY(FPan1,(oni-j)*(1/oni),(oni-n)*(1/oni),1/oni,1/oni);
        Crt(m)=uicontrol('units','pixels','style','togglebutton','parent',FPan1,...
            'position',pos2,'string','','callback',@CButtonFun,'backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75]); %#ok<AGROW>
    end
end

%--set inbut buttons logos
%.........................
SetInbutLogo(TextType);
%.........................

%--------------------------------------

%--------------------------------------
%Buttons of Mid Panels (Show Script and Edit One Chrecter in Translation)
%--------------------------------------
ob=30;%Number of Columns
hb=3; %Number of Rows

[ShowTotalScript,ShowLatTrans,pos4]=MidPanelButtons(FPanM,FPanML,ob,hb);

    function [ShowTotalScript,ShowLatTrans,pos4]=MidPanelButtons(FPanM,FPanML,ob,hb)
        m=0;
        for nst=1:hb
            for jst=1:ob
                m=m+1;
                pos4=posXY(FPanM,(ob-jst)*(1/ob),(hb-nst)*(1/hb),1/ob,1/hb);
                ShowTotalScript(m)=uicontrol('units','pixels','style','togglebutton','parent',FPanM,...
                    'position',pos4,'string','','backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75],'value',1,'callback',@TButtonFun); %#ok<AGROW>
            end
        end

        %Latin Samples
        m=0;
        for nst=1:hb
            for jst=1:ob
                m=m+1;
                pos4=posXY(FPanML,(jst-1)*(1/ob),(hb-nst)*(1/hb),1/ob,1/hb);
                ShowLatTrans(m)=uicontrol('units','pixels','style','togglebutton','parent',FPanML,...
                    'position',pos4,'backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75],'value',1,'callback',@ShowLatTransFun); %#ok<AGROW>
            end
        end
    end

posup=posXY(FPanMLM,0/30,0/30,1/30,30/30);
logo=getbuttonlogo(CDr,'up_off',[],[posup(4),posup(3)]);
UpButton=uicontrol('units','pixels','style','pushbutton','parent',FPanMLM,...
    'position',posup,'backgroundcolor',[1 1 1],'cdata',logo,'callback',@UpButton_p,'enable','off');
posdown=posXY(FPanMLM,29/30,0/30,1/30,30/30);
logo=getbuttonlogo(CDr,'down_off',[],[posdown(4),posdown(3)]);
DownButton=uicontrol('units','pixels','style','pushbutton','parent',FPanMLM,...
    'position',posdown,'backgroundcolor',[1 1 1],'cdata',logo,'callback',@DownButton_p,'enable','off');

%--------------------------------------

%--------------------------------------
%Lowest Panel Buttons (Adding Symbol Buttons)
%--------------------------------------

hsbm=6;%Number of Buttons om*hm
%SymButnsS=Cacv(end-(hsbm-1):end);
for ams=1:hsbm
        posASB=posXY(symbols_pn,(hsbm-ams)*(1/hsbm),0,1/hsbm,1);
        SymButns(ams)=uicontrol('units','pixels','style','togglebutton','parent',symbols_pn,...
            'position',posASB,'string','','backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75],...
            'callback',@SymButnsFun); %#ok<AGROW>
end

for n=1:hsbm
    logo=getbuttonlogo(CDr,'LateC',AdMS(n),[posASB(4),posASB(3)]);
    set(SymButns(n),'cdata',logo);
end

%
%--------------------------------------
%Buttons of Right Panels
%--------------------------------------
pos=posXY(FPanRu,0.5/40,(3*(10/40)+0/40),37/40,10/40);
BackSpaceButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRu,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'Enable','off','callback',@BackSpaceButton_p,'TooltipString','BackSpace');
logo=getbuttonlogo(CDr,'BackSpace',[],[pos(4),pos(3)]);
set(BackSpaceButton,'CData',logo);

pos=posXY(FPanRu,0.5/40,(2*(10/40)+0/40),37/40,10/40);
EditButton=uicontrol('units','pixels','style','togglebutton','parent',FPanRu,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@EditButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Edit');
logo=getbuttonlogo(CDr,'Edit',[],[pos(4),pos(3)]);
set(EditButton,'CData',logo);

pos=posXY(FPanRu,0.5/40,(1*(10/40)+0/40),37/40,10/40);
RestButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRu,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@RestButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Rest');
logo=getbuttonlogo(CDr,'Rest',[],[pos(4),pos(3)]);
set(RestButton,'CData',logo);

pos=posXY(FPanRu,0.5/40,(0*(10/40)+0/40),37/40,10/40);
ClearButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRu,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@ClearButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Clear');
logo=getbuttonlogo(CDr,'Clear',[],[pos(4),pos(3)]);
set(ClearButton,'CData',logo);

%=========Mid
posfzok=posXY(FPanRmu11,0/40,3/40,40/40,24/40);
SellectFontSize=uicontrol('Units','pixels','style','slider','value',4,'position',posfzok,...
    'Parent',FPanRmu11,'min',0,'max',10,'sliderstep',[.1,.1],'callback',@SellectFontSize_p);

posfzok1=posXY(FPanRmu12,1/40,0/40,35/40,25/40);
SellectFontSize_t=uicontrol('units','pixels','style','text','parent',FPanRmu12,...
    'position',posfzok1,'string','12','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'fontname','Times New Roman','FontWeight','bold','HorizontalAlignment','center');

posfzok=posXY(FPanRmu22,0/40,0/40,40/40,40/40);
FontSizeOk=uicontrol('units','pixels','style','pushbutton','parent',FPanRmu22,...
    'position',posfzok,'string','OK','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@FontSizeOk_p,'fontname','Times New Roman','fontsize',12,'FontWeight','bold'); %#ok<NASGU>

pos=posXY(FPanRmu3,0/40,13/40,39/40,20/40);
SelectFontType=uicontrol('units','pixels','style','popupmenu','parent',FPanRmu3,...
    'position',pos,'string',ScrNa,'backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@SelectFontType_f,'fontsize',8,'value',1);

posnc=posXY(FPanRmu41,1/40,0/40,38/40,40/40);
SellectNumberOfCell=uicontrol('Units','pixels','style','slider','value',3,'position',posnc,...
    'Parent',FPanRmu41,'min',0,'max',10,'sliderstep',[.1,.1],'callback',@SellectNumberOfCell_p);

posncok1=posXY(FPanRmu42,1/40,5/40,35/40,30/40);
SellectNumberOfCell_t=uicontrol('units','pixels','style','text','parent',FPanRmu42,...
    'position',posncok1,'string','3','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'fontname','Times New Roman','FontWeight','bold','HorizontalAlignment','center');

posncok=posXY(FPanRmu52,0/40,0/40,40/40,40/40);
NumberOfCellOk=uicontrol('units','pixels','style','pushbutton','parent',FPanRmu52,...
    'position',posncok,'string','OK','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@NumberOfCellOk_p,'enable','off','fontname','Times New Roman',...
    'fontsize',12,'FontWeight','bold','TooltipString','Select The Number Of Row Which Script is Written In');


%Add, Substiution and delete buttons
%--------------------------------------
posm=posXY(FPanRmd_11_Char,25.5/40,1/40,11/40,38/40);
Achar_S_Button=uicontrol('units','pixels','style','pushbutton','parent',FPanRmd_11_Char,...
    'position',posm,'string','S','backgroundcolor',[0 0 0],'foregroundcolor',...
    [0.5 1 0.5],'callback',@Achar_S_Button_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString',' Character Substitution','enable','off');
%logo=getbuttonlogo(CDr,'Rest',[],[pos(4),pos(3)]);
%set(Achar_Normal_Button,'CData',logo);
posm=posXY(FPanRmd_11_Char,13.5/40,1/40,11/40,38/40);
Achar_A_Button=uicontrol('units','pixels','style','pushbutton','parent',FPanRmd_11_Char,...
    'position',posm,'string','A','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@Achar_A_Button_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Add Character','enable','off');
posm=posXY(FPanRmd_11_Char,1.5/40,1/40,11/40,38/40);
Achar_D_Button=uicontrol('units','pixels','style','pushbutton','parent',FPanRmd_11_Char,...
    'position',posm,'backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@Achar_D_Button_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Delete Character','enable','off');
logo=getbuttonlogo(CDr,'D_Button',[],[posm(4),posm(3)]);
set(Achar_D_Button,'CData',logo);

%New Line Button
%--------------------
posm=posXY(FPanRmd_21_NewLine,1/40,1/40,38/40,38/40);
NewLine_Button=uicontrol('units','pixels','style','pushbutton','parent',FPanRmd_21_NewLine,...
    'position',posm,'backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@NewLine_Button_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','New Line','enable','off');
logo=getbuttonlogo(CDr,'NL',[],[posm(4),posm(3)]);
set(NewLine_Button,'CData',logo);


%Use Deffrents of Options for some charecters
m=0;
UucrS=Cacv(end-(15+(hsbm+1)):(end-(hsbm+1)));
om=3;
hm=6;%Number of Buttons om*hm
for n=1:hm
    for j=1:om
        m=m+1;
        posmdb=posXY(FPanRmd,(om-j)*(1/om),(hm-n)*(1/hm),1/om,1/hm);
        Uucr(m)=uicontrol('units','pixels','style','togglebutton','parent',FPanRmd,...
            'position',posmdb,'string','','backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75],...
            'callback',@UucrButtonFun,'enable','on'); %#ok<AGROW>
    end
end

for n=1:length(UucrS)
    set(Uucr(n),'string',UucrS(n));
end
set(Uucr(n+1:end),'enable','off');

%Logo Button
%------------
posm=posXY(FPanRmd_1,1/40,0/40,38/40,20/40);
logo=getbuttonlogo(CDr,'logo',[],[posm(4),posm(3)]);
Logo_Button=uicontrol('units','pixels','style','pushbutton','parent',FPanRmd_1,...
    'position',posm,'cdata',logo); %#ok<NASGU>

%=========Mid

pos=posXY(FPanRd,0.5/40,(3*(10/40)+0/40),18.5/40,10/40);
GoLeftP=uicontrol('units','pixels','style','pushbutton','parent',FPanRd,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@GoLeftP_p,'fontname','Times New Roman','fontsize',12,'FontWeight','bold');
set(GoLeftP,'enable','off');
logo=getbuttonlogo(CDr,'GoLeft',[],[pos(4),pos(3)]);
set(GoLeftP,'CData',logo);
pos=posXY(FPanRd,19.5/40,(3*(10/40)+0/40),18.5/40,10/40);
GoRihgtP=uicontrol('units','pixels','style','pushbutton','parent',FPanRd,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@GoRihgtP_p,'fontname','Times New Roman','fontsize',12,'FontWeight','bold');
logo=getbuttonlogo(CDr,'GoRihgt',[],[pos(4),pos(3)]);
set(GoRihgtP,'CData',logo);

pos=posXY(FPanRd,0.5/40,(2*(10/40)+0/40),37/40,10/40);
SaveButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRd,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@SaveButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Save','enable','off');
logo=getbuttonlogo(CDr,'Save',[],[pos(4),pos(3)]);
set(SaveButton,'CData',logo);

pos=posXY(FPanRd,0.5/40,(1*(10/40)+0/40),37/40,10/40);
LoadButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRd,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@LoadButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Load');
logo=getbuttonlogo(CDr,'Load',[],[pos(4),pos(3)]);
set(LoadButton,'CData',logo);

pos=posXY(FPanRd,0.5/40,0/40,37/40,10/40);
ExitButton=uicontrol('units','pixels','style','pushbutton','parent',FPanRd,...
    'position',pos,'string','','backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'callback',@ExitButton_p,'fontname','Times New Roman','fontsize',...
    12,'FontWeight','bold','TooltipString','Exit From Program');
logo=getbuttonlogo(CDr,'Exit',[],[pos(4),pos(3)]);
set(ExitButton,'CData',logo);

%--------------------------------------

%--------------------------------------
%Buttons of Left Panels
%--------------------------------------
m=0;
otb=3;
htb=20;
for n=1:htb
    for j=1:otb
        m=m+1;
        pos5=posXY(FPanLu,(otb-j)*(1/otb),(htb-n)*(1/htb),1/otb,1/htb);
        ShowEditTotalScript(m)=uicontrol('units','pixels','style','togglebutton','parent',FPanLu,...
            'position',pos5,'string','','backgroundcolor',[0 0 0],'foregroundcolor',[1 1 0.75],...
            'callback',@ETButtonFun,'enable','off'); %#ok<AGROW>
        
        t=cell2mat(FntNa(3,TextType));
        
        LogoShowEditTotalScript(m,t);
    end
end

pos6=posXY(FPanLd,0.5/40,(3*(10/40)+0/40)+1/40,37/40,8/40);
ShowChrValue_Ar=uicontrol('units','pixels','style','togglebutton','parent',FPanLd,...
    'position',pos6,'value',0,'backgroundcolor',[0 0 0],...
    'fontsize',14,'fontname','times new roman','foregroundcolor',[1 1 0.75],'callback',@ShowChrValue_Ar_p);

pos6=posXY(FPanLd,0.5/40,(2*(10/40)+0/40)+1/40,37/40,8/40);
ShowChrValue_La=uicontrol('units','pixels','style','togglebutton','parent',FPanLd,...
    'position',pos6,'value',0,'backgroundcolor',[0 0 0],...
    'fontsize',14,'fontname','times new roman','foregroundcolor',[1 1 0.75],'callback',@ShowChrValue_La_p);

pos=posXY(FPanLd,0.5/40,(1*(10/40)+0/40),37/40,7/40);
ChooseChrValue=uicontrol('units','pixels','style','popupmenu','parent',FPanLd,...
    'position',pos,'string',Cacv(1:end-(16+hsbm+1)),'backgroundcolor',[0 0 0],'foregroundcolor',...
    [1 1 0.75],'Enable','off','callback',@ChooseChrValue_p);

pos=posXY(FPanLd,0.5/40,(0*(10/40)+0/40),37/40,10/40);
ApplyChangeButton=uicontrol('units','pixels','style','pushbutton','parent',FPanLd,...
    'fontsize',12,'fontname','times new roman','fontweight','bold','position',pos,'string','Apply','Visible','off','callback',@ApplyChangeButton_p);
CloseEditMenu=uicontrol('units','pixels','style','pushbutton','parent',FPanLd,...
    'fontsize',12,'fontname','times new roman','fontweight','bold','position',pos,'string','Close','enable','off','callback',@CloseEditMenu_p);
%--------------------------------------


%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

%--------------------------------------
%Show Translation (Upper Panel)
%--------------------------------------
pos3=posXY(FPan22,0,0,1,1);
Cshow=uicontrol('style','text','units','pixels','backgroundcolor',[0 0 0],...
    'parent',FPan22,'foregroundcolor',[1 1 0.75],'position',pos3,'fontname',...
    'Times New Roman','fontsize',12,'FontWeight','bold');
%--------------------------------------

%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
%-Functions-:-Functions-:-Functions-:-Functions-:-Functions-:-Functions-:--
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------

%--------------------------------------
%Input Buttons (Lower Panel)
%--------------------------------------
    function SetNewWindowName
        NewName=['Semitic to Arabic :  ',cell2mat(ScrNa(TextType)), '  (Demo version)'];
        set(fig,'Name',NewName);
    end
    function CButtonFun(Crt,eventdata) %#ok<INUSD>

        Cnum=CFun(Cnum);
        
        LogoArabicLatinValues(Cstor);
        
        if Cnum>0
            
            if isequal(get(BackSpaceButton,'Enable'),'off')==1
                set(BackSpaceButton,'Enable','on');
                set(SaveButton,'enable','on');
                set(NewLine_Button,'enable','on');
            end
            
            newt=ButtonValue(Cstor);
            
            t=cell2mat(FntNa(3,TextType));            
            
            if FSTS_store(1)==0
                addt=1;%add new charecter to script/translation/TextStore
                
                TextStore=NewText(addt,newt,TextStore);
                ShowTranslation(TextStore);
                
                ShowScriptText(Cstor,t);
            elseif FSTS_store(1)==1
                logo=getbuttonlogo(CDr,t,Cstor,[pos4(4),pos4(3)]);
                logo2=getbuttonlogo(CDr,'LatC',CurentFont(2,Cstor,TextType),[pos4(4),pos4(3)]);
                set(ShowTotalScript(FSTS_store(2)),'cdata',logo);
                set(ShowTotalScript,'value',1);
                set(ShowLatTrans(FSTS_store(2)),'cdata',logo2);

                %==========================================================
                Cnum=Cnum-1;
                Afs=((hb*ob)*fix((Cnum)/(hb*ob)))+FSTS_store(2);
                if Afs>length(ScriptStore)
                    Afs=Afs-(hb*ob);
                end
                ScriptStore(Afs)=Cstor;
                TextStore(Afs)=newt;
                ApplyEditingInTranslation(TextType,ScriptStore);
                %==========================================================
                
                FSTS_store=[0,0];
                set([Achar_S_Button,Achar_A_Button,Achar_D_Button],'enable','off','foregroundcolor',[1 1 0.75]);
                set(Achar_S_Button,'foregroundcolor',[0.5 1 0.5]);
            end
            
        elseif Cnum<0
            Cnum=abs(Cnum);
        end
    end

    function Cnum=CFun(Cnum)

        t=cell2mat(FntNa(1,TextType));
        
        ChangeOneButtonLogo(Cstor,t);
        
        for m=1:oni^2 %#ok<FXUP>
            if get(Crt(m),'value')==1
                set(Crt(m),'value',0);
                Cstor=m;
                m=oni^2; %#ok<FXSET>
            end
        end
            
        if Cstor<=NumberOfCharacter(TextType)
            t=cell2mat(FntNa(2,TextType));
            
            ChangeOneButtonLogo(Cstor,t);
            Cnum=Cnum+1;
            
        elseif Cstor>NumberOfCharacter(TextType)
            Cnum=-Cnum;
        end
    end

    function SetInbutLogo(TextType)
        g=NumberOfCharacter(TextType);
        t=cell2mat(FntNa(1,TextType));
        
        for nd=1:g
            ChangeOneButtonLogo(nd,t);
        end
    end

    function ChangeOneButtonLogo(nB,t)
        logo=getbuttonlogo(CDr,t,nB,[pos2(4),pos2(3)]);
        if length(logo)>1
            set(Crt(nB),'cdata',logo);
        end
    end
%--------------------------------------

%--------------------------------------
%Buttons of Mid Panels (Show Script and Edit One Chrecter in Translation)
%--------------------------------------
    function TButtonFun(ShowTotalScript,eventdata) %#ok<INUSD>
        set([Achar_S_Button,Achar_A_Button,Achar_D_Button],'enable','off','foregroundcolor',[1 1 0.75]);
        set(Achar_S_Button,'foregroundcolor',[0.5 1 0.5]);
        
        a=ShowTotalScript_fun;
        FSTS_store=a;
    end

    function FSTS_store=ShowTotalScript_fun
        FSTS_store=[0,0];
        b=ob*hb;
        kk=NScriptCrecter;
        if length(ScriptStore)>1
            if kk==1 | kk==ob*hb %#ok<OR2>
                kk=b+1;
            end
        end
        for nt=1:b
            q=get(ShowTotalScript(nt),'value');
            if q==0
                set(ShowTotalScript,'value',1);
                if nt<=kk-1
                    set(ShowTotalScript(nt),'value',0);
                    FSTS_store(1)=1;
                    FSTS_store(2)=nt;
                    
                    set([Achar_S_Button,Achar_A_Button,Achar_D_Button],'enable','on');
                end
                nt=b; %#ok<FXSET>
            end
        end
    end

    function ShowLatTransFun(ShowLatTrans,eventdata) %#ok<INUSD>
        set(ShowLatTrans,'value',1);
    end

    function UpButton_p(UpButton,eventdata) %#ok<INUSD>
        ny=round(Cnum/(hb*ob));
        
        if StoreCrecterUsesOfScript(3)<ny
            set(DownButton,'enable','on');
            
            a=StoreCrecterUsesOfScript(1)-(hb*ob);
            b=StoreCrecterUsesOfScript(1)-1;
            NScriptCrecter=(hb*ob);
            ChangeScriptLogo(a,b);
            
            if a-(hb*ob)<=0
                set(UpButton,'enable','off');
            end
            
        end
        
        StoreCrecterUsesOfScript(3)=StoreCrecterUsesOfScript(3)+1;
    end

    function DownButton_p(DownButton,eventdata) %#ok<INUSD>
        
        if StoreCrecterUsesOfScript(3)>=0
            
            StoreCrecterUsesOfScript(3)=StoreCrecterUsesOfScript(3)-1;

            set(UpButton,'enable','on');
            
            if StoreCrecterUsesOfScript(3)>0
                b=StoreCrecterUsesOfScript(2)+(hb*ob);
                a=StoreCrecterUsesOfScript(1)+(hb*ob);
                
                NScriptCrecter=(hb*ob);
                
            elseif StoreCrecterUsesOfScript(3)==0
                b=Cnum;
                a=StoreCrecterUsesOfScript(1)+(hb*ob);
                set(DownButton,'enable','off');
                
                NScriptCrecter=Cnum-(round(Cnum/(hb*ob))*(hb*ob));

                if NScriptCrecter<0%22
                    NScriptCrecter=(hb*ob)+NScriptCrecter+1;%22
                end%22
                
                t=cell2mat(FntNa(3,TextType));
                
                logo=getbuttonlogo(CDr,t,0,[pos4(4),pos4(3)]);
%                set(ShowTotalScript(NScriptCrecter:(hb*ob)),'cdata',logo);%11
%                set(ShowLatTrans(NScriptCrecter:(hb*ob)),'cdata',logo);%11
                set(ShowTotalScript,'cdata',logo);%22
                set(ShowLatTrans,'cdata',logo);%22
                
            end
            
            ChangeScriptLogo(a,b);
        end
    end

%--------------------------------------

%--------------------------------------
%Lowest Panel Buttons (Adding Symbol Buttons)
%--------------------------------------
    function SymButnsFun(SymButns,eventdata) %#ok<INUSD>
        SymButnsN=SymButnsNFun;
        
        kslk=NumberOfCharacter(TextType)+length(FntMa)+SymButnsN+1;
        
        if FSTS_store(1)==0
            if isequal(get(BackSpaceButton,'Enable'),'off')==1
                set(BackSpaceButton,'Enable','on');
                set(SaveButton,'enable','on');
                set(NewLine_Button,'enable','on');
            end
            Cnum=Cnum+1;
            TextStore(Cnum)=ACVaS(SymButnsN);
            
            ShowTranslation(TextStore);
            ShowScriptText(kslk,'LatC');
            
        elseif FSTS_store(1)==1
            set(ShowTotalScript,'value',1);
            
            Afs=((hb*ob)*fix((Cnum)/(hb*ob)))+FSTS_store(2);
            
            if Afs>length(ScriptStore)
                Afs=Afs-(hb*ob);
            end
            
            ScriptStore(Afs)=kslk;
            TextStore(Afs)=ACVaS(SymButnsN);
            
            klk=CurentFont(2,kslk,TextType);
            logo=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
            logo2=imrotate(logo,180);
            
            set(ShowTotalScript(FSTS_store(2)),'cdata',logo);
            set(ShowTotalScript,'value',1);
            set(ShowLatTrans(FSTS_store(2)),'cdata',logo2);

            ApplyEditingInTranslation(TextType,ScriptStore)            
            FSTS_store=[0,0];
        end
        
        
    end

    function SymButnsN=SymButnsNFun
        for m=1:hsbm %#ok<FXUP>
            if get(SymButns(m),'value')==1
                set(SymButns(m),'value',0);
                SymButnsN=m;
                m=SymButns; %#ok<FXSET>
            end
        end
    end

%--------------------------------------
%Buttons of Right Panels
%--------------------------------------
    function BackSpaceButton_p(BackSpaceButton,eventdata) %#ok<INUSD>
        if Cnum>0
            b=1611:1618;
            a=TextStore(end);
            c=a-b;
            a=0;
            for b=1:length(c)
                if c(b)==0
                    a=1;
                end
            end
            if a==1
                Cnum=Cnum-2;
                TextStore=TextStore(1:end-2);
            else
                Cnum=Cnum-1;
                TextStore=TextStore(1:end-1);
            end
            NScriptCrecter_temp=NScriptCrecter-1;
            
            ScriptStore=ScriptStore(1:end-1);
            
            set(Cshow,'string',char(TextStore));
            t=cell2mat(FntNa(3,TextType));
            tt=cell2mat(FntNa(1,TextType));

            if length(ScriptStore)==(hb*ob)
                NScriptCrecter_temp=-1;
                ShowTranslation(TextStore);
                
                for NS=1:(hb*ob)
                    nB=ScriptStore(NS);
                    logo=getbuttonlogo(CDr,t,nB,[pos4(4),pos4(3)]);
                    logo2=getbuttonlogo(CDr,'LatC',CurentFont(2,nB,TextType),[pos4(4),pos4(3)]);
                    set(ShowTotalScript(NS),'cdata',logo);
                    set(ShowLatTrans(NS),'cdata',logo2);
                end
                NScriptCrecter=1;
            end
            
            if length(ScriptStore)==(hb*ob)-1
                NScriptCrecter_temp=(hb*ob);
                ShowTranslation(TextStore);
            end
            
            if NScriptCrecter_temp>0
                NScriptCrecter=NScriptCrecter_temp;

                logo=getbuttonlogo(CDr,t,0,[pos4(4),pos4(3)]);
                set(ShowTotalScript(NScriptCrecter),'cdata',logo);
                set(ShowLatTrans(NScriptCrecter),'cdata',logo);
                
                if NScriptCrecter==1
                    set(BackSpaceButton,'enable','off');
                    set(NewLine_Button,'enable','off');
                end
            end

            ChangeOneButtonLogo(Cstor,tt);
            
            if length(ScriptStore)==(hb*ob)+1
                set([UpButton,DownButton],'enable','off');
            end
            
            
        end
        
        if Cnum==0
            set(SaveButton,'enable','off');
        end
        
    end

    function EditButton_p(EditButton,eventdata) %#ok<INUSD>

        set(ChooseChrValue,'enable','off','value',1);
        set(ApplyChangeButton,'visible','off');
        set(CloseEditMenu,'visible','on');
        
        if get(EditButton,'value')==1
            set([Crt,ShowTotalScript],'Enable','off');
            set([ClearButton,RestButton,LoadButton,GoLeftP,GoRihgtP,...
                SelectFontType,SaveButton,BackSpaceButton],'Enable','off');
            set([ShowEditTotalScript,CloseEditMenu],'Enable','on');
            set(NewLine_Button,'enable','off');
        elseif get(EditButton,'value')==0
            set([Crt,ShowTotalScript],'Enable','on');
            set([ClearButton,RestButton,LoadButton,GoLeftP,GoRihgtP,...
                SelectFontType],'Enable','on');
            set([ShowEditTotalScript,CloseEditMenu],'Enable','off');
            
            if Cnum>0
                set([BackSpaceButton,SaveButton],'Enable','on');
                set(NewLine_Button,'enable','on');
            end
            if npkN==1
                set(GoLeftP,'enable','off');
            elseif npkN==npk
                set(GoRihgtP,'enable','off');
            end
        end
    end

    function RestButton_p(RestButton,eventdata) %#ok<INUSD>
        CurentFont(1,1:(NumberOfCharacter(TextType)+length(FntMa)+length(FntMb)),TextType)=ACV(FntM(TextType,1:(NumberOfCharacter(TextType)+length(FntMa)+length(FntMb))));
        CurentFont(2,:,TextType)=FntMS(TextType,:);
        
        LogoArabicLatinValues(58);
%        CurentFont=RecoverFontSettings(TextType,FntM1(1,:));
        
        ApplyEditingInTranslation(TextType,ScriptStore);
    end

    function ClearButton_p(ClearButton,eventdata) %#ok<INUSD>
        
        [Cstor,Cnum,TextStore,NScriptCrecter,StoreCrecterUsesOfScript,FSTS_store,ETB_store,ScriptStore,Cacv]=StartParameter;
        
        SetInbutLogo(TextType);

        t=cell2mat(FntNa(3,TextType));
        
        logo=getbuttonlogo(CDr,t,0,[pos4(4),pos4(3)]);

        set(ShowTotalScript,'value',1,'cdata',logo);
        set(ShowLatTrans,'cdata',logo);
        
        %---------->>>>>>>>>>>>>>>>>>
        set(Cshow,'string','');
        
        set([SaveButton,BackSpaceButton,UpButton,DownButton],'enable','off');
        set(NewLine_Button,'enable','off');
    end

%=========Mid

    function SellectFontSize_p(SellectFontSize,eventdata) %#ok<INUSD>
        a=get(SellectFontSize,'value');
        set(SellectFontSize_t,'string',num2str(8+a));
    end

    function FontSizeOk_p(FontSizeOk,eventdata) %#ok<INUSD>
        a=get(SellectFontSize,'value');
        a=a+8;
        set(Cshow,'fontsize',a);
        ApplyEditingInTranslation(TextType,ScriptStore);
    end

    function SelectFontType_f(SelectFontType,eventdata) %#ok<INUSD>

        a=get(SelectFontType,'value');
%        if a~=TextType
%            Confirm=questdlg('You''re about changing the font''s type, That will be cause to delete all previews data, Are you sure you want to do that. You can choose "Yes But Keep Changes" to keep your change in settings','Confirm Opration','Yes','Yes But Keep Changes','No','No');
%            switch(Confirm)
%                case 'Yes'
                    ClearButton_p(ClearButton,[]);
                    TextType=a;
                    set(Crt,'cdata',[]);
                    set(ShowEditTotalScript,'cdata',[]);
                    SetInbutLogo(TextType);
                    
                    t=cell2mat(FntNa(3,TextType));
                    
                    for jm=1:(otb*htb)
                        LogoShowEditTotalScript(jm,t);
                    end
                    
%                case 'Yes But Keep Changes'
                    
%                    ClearButton_p(ClearButton,[]);
%                    TextType=a;
%                    set(Crt,'cdata',[]);
%                    set(ShowEditTotalScript,'cdata',[]);
%                    SetInbutLogo(TextType);
                    
%                    t=cell2mat(FntNa(3,TextType));
                    
%                    for jm=1:(otb*htb)
%                        LogoShowEditTotalScript(jm,t);
%                    end
                    
%                case 'No'
%                    set(SelectFontType,'value',TextType);
                    
%            end
%        end
        
        set(MF_Script_Name_S,'Checked','off');
        set(MF_Script_Name_S(TextType),'Checked','on');
        SetNewWindowName;
    end

    function SellectNumberOfCell_p(SellectNumberOfCell,eventdata) %#ok<INUSD>
        a=get(SellectNumberOfCell,'value');
        if a>4
            a=4;
        elseif a<=1
            a=1;
        end
        set(SellectNumberOfCell_t,'string',num2str(a));
        set(SellectNumberOfCell,'value',a);
        if hb~=a
            set(NumberOfCellOk,'enable','on');
        elseif hb==a
            set(NumberOfCellOk,'enable','off');
        end
    end

    function NumberOfCellOk_p(NumberOfCellOk,eventdata) %#ok<INUSD>
        set(NumberOfCellOk,'enable','off');
        a=get(SellectNumberOfCell,'value');
        if a>4
            a=4;
        elseif a<=1
            a=1;
        end
        
        ob=a*10;%Number of Columns
        hb=a;   %Number of Rows
        set([FPanA1R1,FPanA1RR1,FPanA2L1,FPanA2LL1],'Backgroundcolor',[0.2 1 0.2]);
        set(BTitle,'string','Please Wait','Foregroundcolor',[0.2 1 0.2]);
        pause(0.001);
        [ShowTotalScript,ShowLatTrans,pos4]=MidPanelButtons(FPanM,FPanML,ob,hb);
        set([FPanA1R1,FPanA1RR1,FPanA2L1,FPanA2LL1],'Backgroundcolor',[0 0 0]);
        
        if Cnum>0
            NScriptCrecter=1;
            
            t=cell2mat(FntNa(3,TextType));
            
            for nsst=1:Cnum
                ShowScriptText(ScriptStore(nsst),t);
            end
            
            ShowTranslation(TextStore);
            
            StoreCrecterUsesOfScript(1)=Cnum-(NScriptCrecter-2);
            StoreCrecterUsesOfScript(2)=Cnum;
            StoreCrecterUsesOfScript(3)=0;
            
        end

        set(BTitle,'string','Semitic Into Arabic','Foregroundcolor',[1 1 0.75]);
    end

%New***********************************************************************
%**************************************************************************
%Add, Substiution and delete cherecters
%--------------------------------------
    function Achar_S_Button_p(Achar_S_Button,eventdata) %#ok<INUSD>
        if get(Achar_S_Button,'value')==1
            set(Achar_S_Button,'foregroundcolor',[0.5 1 0.5]);
            set([Achar_A_Button,Achar_D_Button],'foregroundcolor',[1 1 0.75]);
            
            msgbox('This is not available in this demo version','Sorry');
        end
    end
    function Achar_A_Button_p(Achar_A_Button,eventdata) %#ok<INUSD>
        if get(Achar_A_Button,'value')==1
            set(Achar_A_Button,'foregroundcolor',[0.5 1 0.5]);
            set([Achar_D_Button,Achar_S_Button],'foregroundcolor',[1 1 0.75]);
            
            msgbox('This is not available in this demo version','Sorry');
        end
    end
    function Achar_D_Button_p(Achar_D_Button,eventdata) %#ok<INUSD>
        if get(Achar_D_Button,'value')==1
            set(Achar_D_Button,'foregroundcolor',[0.5 1 0.5]);
            set([Achar_A_Button,Achar_S_Button],'foregroundcolor',[1 1 0.75]);
            
            set([Achar_A_Button,Achar_S_Button,Achar_D_Button],'enable','off');
            
            msgbox('This is not available in this demo version','Sorry');
        end
    end

%New Line Button
%--------------------
    function NewLine_Button_p(NewLine_Button,eventdata) %#ok<INUSD>
        msgbox('This is not available in this demo version','Sorry');
    end

    function UucrButtonFun(Uucr,eventdata) %#ok<INUSD>
        UucrN=UucrFun;
        if isequal(get(BackSpaceButton,'Enable'),'off')==0
            UucrN=ACVoS(UucrN);
            
            if FSTS_store(1)==0
                TextStore(Cnum)=UucrN;
            elseif FSTS_store(1)==1
                set(ShowTotalScript,'value',1);
                
                Afs=((hb*ob)*fix((Cnum)/(hb*ob)))+FSTS_store(2);

                if Afs>length(ScriptStore)
                    Afs=Afs-(hb*ob);
                end
                
                TextStore(Afs)=UucrN;
                FSTS_store=[0,0];
                
                set([Achar_S_Button,Achar_A_Button,Achar_D_Button],'enable','off','foregroundcolor',[1 1 0.75]);
                set(Achar_S_Button,'foregroundcolor',[0.5 1 0.5]);
            end
            ShowTranslation(TextStore);
        end
    end
    function UucrN=UucrFun
        for m=1:om*hm %#ok<FXUP>
            if get(Uucr(m),'value')==1
                set(Uucr(m),'value',0);
                UucrN=m;
                m=oni^2; %#ok<FXSET>
            end
        end
    end
%============

    function GoLeftP_p(GoLeftP,eventdata) %#ok<INUSD>
        if npkN>1
            npkN=npkN-1;
            set(FPanRm(npkN),'visible','on');
            set(FPanRm(npkN+1),'visible','off');
            set(GoRihgtP,'enable','on');
            if npkN==1
                set(GoLeftP,'enable','off');
            end
        else
            npkN=1;
        end
    end

    function GoRihgtP_p(GoRihgtP,eventdata) %#ok<INUSD>
        if npkN<npk
            npkN=npkN+1;
            set(FPanRm(npkN),'visible','on');
            set(FPanRm(npkN-1),'visible','off');
            set(GoLeftP,'enable','on');
            if npkN==npk
                set(GoRihgtP,'enable','off');
            end
        else
            npkN=npk;
        end
    end

    function SaveButton_p(SaveButton,eventdata) %#ok<INUSD>
        msgbox('This is not available in this demo version','Sorry');        
    end

    function LoadButton_p(LoadButton,eventdata) %#ok<INUSD>
        set(LoadButton,'Enable','off');
        set([FPanA1R1,FPanA1RR1,FPanA2L1,FPanA2LL1],'Backgroundcolor',[0.2 1 0.2]);
        set(BTitle,'string','Please Wait','Foregroundcolor',[0.2 1 0.2]);
        
        [fname,path] = uigetfile('*.dat');
        if isnumeric(path)==1 || isnumeric(path)==1
            msgbox('The process canceled by user','Cencel By User','warn');
        else
            FileLocationAndName=sprintf('%s',path,fname);
            LoadpreviewsData(FileLocationAndName);
        end
        
        set(LoadButton,'Enable','on');
        set([FPanA1R1,FPanA1RR1,FPanA2L1,FPanA2LL1],'Backgroundcolor',[0 0 0]);
        set(BTitle,'string','Semitic Into Arabic','Foregroundcolor',[1 1 0.75]);
    end

    function LoadpreviewsData(FileLocationAndName)
        
        imnum=load(FileLocationAndName);
        imnum=imnum';
        TextType=imnum(1);
        imnum=imnum(2:end);
        
        if isempty(imnum)==0
            ClearButton_p(ClearButton,[]);
            
            TextType_Past=get(SelectFontType,'value');
            
            if TextType_Past~=TextType
                
                set(SelectFontType,'value',TextType);
                
                set(Crt,'cdata',[]);
                set(ShowEditTotalScript,'cdata',[]);
                SetInbutLogo(TextType);
                
                t=cell2mat(FntNa(3,TextType));
                
                set(MF_Script_Name_S,'Checked','off');
                set(MF_Script_Name_S(TextType),'Checked','on');
                SetNewWindowName;
                
                for jm=1:(otb*htb)
                    LogoShowEditTotalScript(jm,t);
                end
                
            end
            
            ScriptStore=imnum;
            Cnum=length(imnum);
            
            TextStore=CurentFont(1,ScriptStore,TextType);
            
            t=cell2mat(FntNa(3,TextType));
            
            set(MF_Script_Name_S,'Checked','off');
            set(MF_Script_Name_S(TextType),'Checked','on');
            SetNewWindowName;
            
            for nsst=1:Cnum
                ShowScriptText(imnum(nsst),t);
            end
            
            ShowTranslation(TextStore);
            set(BackSpaceButton,'Enable','on');
            set(SaveButton,'Enable','on');
            set(NewLine_Button,'enable','on');
            
            LogoArabicLatinValues(CurentFont(2,imnum(end),TextType));
            
            StoreCrecterUsesOfScript(1)=Cnum-(NScriptCrecter-2);
            StoreCrecterUsesOfScript(2)=Cnum;
            StoreCrecterUsesOfScript(3)=0;
        end
    end
        
    function ExitButton_p(ExitButton,eventdata) %#ok<INUSD>
        close all;
    end
%--------------------------------------

%--------------------------------------
%Buttons of Left Panels
%--------------------------------------
    function ETButtonFun(ShowEditTotalScript,eventdata) %#ok<INUSD>
        ETB_store=ShowEditTotalScript_fun;
        
        if ETB_store(1)~=0
            set(ChooseChrValue,'enable','on','value',1);
            set(ApplyChangeButton,'visible','off');
            set(CloseEditMenu,'visible','on');
            
            LogoArabicLatinValues(ETB_store(1));
            
        elseif ETB_store(1)==0
            set(ChooseChrValue,'enable','off','value',1);
            set(ApplyChangeButton,'visible','off');
            set(CloseEditMenu,'visible','on');
        end
        
    end

    function ETB_store=ShowEditTotalScript_fun

        %First Chake if the pushing button is including in the range of the number of
        %characters uses or not, and then, if yes, make the character's
        %number as output, if no, set the output embty.
        ntr=[];
        b=NumberOfCharacter(TextType);
        for nt=1:b
            q=get(ShowEditTotalScript(nt),'value');
            if q==1
                set(ShowEditTotalScript(nt),'value',0);
                ntr=nt;
                nt=b; %#ok<FXSET>
            end
        end
        set(ShowEditTotalScript,'value',0);

        if isempty(ntr)==0
            ETB_store=[ntr,CurentFont(1,ntr,TextType)];
        elseif isempty(ntr)==1
            ETB_store=[0,0];
        end
    end

    function LogoShowEditTotalScript(ButtonNum,t)
        logo=getbuttonlogo(CDr,t,ButtonNum,[pos5(4),pos5(3)]);
        
        if length(logo)>1
            set(ShowEditTotalScript(ButtonNum),'cdata',logo);
        end
    end

    function LogoArabicLatinValues(ButtonNum)
        ButtonNum=CurentFont(2,ButtonNum,TextType);
        logo1=getbuttonlogo(CDr,'Arb',ButtonNum,[pos6(4),pos6(3)]);
        logo2=getbuttonlogo(CDr,'Lat',ButtonNum,[pos6(4),pos6(3)]);
        
        if length(logo1)>1
            set(ShowChrValue_Ar,'cdata',logo1);
            set(ShowChrValue_La,'cdata',logo2);
        end
    end

    function ShowChrValue_Ar_p(ShowChrValue_Ar,eventdata) %#ok<INUSD>
        if get(ShowChrValue_Ar,'value')==1
            set(ShowChrValue_Ar,'value',0);
        end
    end
    function ShowChrValue_La_p(ShowChrValue_La,eventdata) %#ok<INUSD>
        if get(ShowChrValue_La,'value')==1
            set(ShowChrValue_La,'value',0);
        end
    end

    function ChooseChrValue_p(ChooseChrValue,eventdata) %#ok<INUSD>
        V=get(ChooseChrValue,'value');
        ETB_store(2)=V;

        set(ApplyChangeButton,'visible','on');
        set(CloseEditMenu,'visible','off');
    end

    function ApplyChangeButton_p(ApplyChangeButton,eventdata) %#ok<INUSD>
        set(ApplyChangeButton,'visible','off');
        set(CloseEditMenu,'visible','on');
        set(ChooseChrValue,'enable','off');
        
        CurentFont(1,ETB_store(1),TextType)=ACV(ETB_store(2));

        if TextType==1
            if ETB_store(2)>=14
                ETB_store(2)=ETB_store(2)+1;
            end
        end
        
        CurentFont(2,ETB_store(1),TextType)=ETB_store(2);
        
        LogoArabicLatinValues(ETB_store(1));
        ApplyEditingInTranslation(TextType,ScriptStore);
        
    end

    function CloseEditMenu_p(CloseEditMenu,eventdata) %#ok<INUSD>
        set(EditButton,'value',0);
        EditButton_p(EditButton,[]);
    end
%--------------------------------------

%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

%--------------------------------------
%<<Functions>><<Functions>><<Functions>><<Functions>><<Functions>><<Functio
%ns>><<Functions>><<Functions>><<Functions>><<Functions>><<Functions>><<Fun
%ctions>><<Functions>><<Functions>><<Functions>><<Functions>><<Functions>><
%--------------------------------------
    function newt=ButtonValue(Cstor)
        newt=CurentFont(1,Cstor,TextType);
    end

    function TextStore=NewText(addt,newt,TextStore)
        if addt==1
            TextStore(Cnum)=newt;
%        elseif addt==-1
%            Cnum=Cnum-1;
%            TextStore(Cnum)=newt;
%            NScriptCrecter=NScriptCrecter-1;
%        elseif addt==2
%            TextStore(Cnum)=newt(1);
%            Cnum=Cnum+1;
%            TextStore(Cnum)=newt(2);
        end
    end

    function ShowTranslation(TextStore)
        set(Cshow,'string','');
        set(Cshow,'string',char(TextStore));
    end
            
    function ShowScriptText(nB,t)
        if NScriptCrecter==1
            logo=getbuttonlogo(CDr,t,0,[pos4(4),pos4(3)]);
            set(ShowTotalScript,'value',1,'cdata',logo);
            set(ShowLatTrans,'cdata',logo);
        end
        
        klk=CurentFont(2,nB,TextType);
        
        if klk<=NES
            logo=getbuttonlogo(CDr,t,nB,[pos4(4),pos4(3)]);
            logo2=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
        elseif klk>NES
            if klk==NLsym(2)
                logo=getbuttonlogo(CDr,'NLC',1,[pos4(4),pos4(3)]);
                logo2=getbuttonlogo(CDr,'NLC',2,[pos4(4),pos4(3)]);
            elseif klk>=lLs && klk<=rLs
                logo=getbuttonlogo(CDr,t,nB,[pos4(4),pos4(3)]);
                logo2=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
            elseif klk~=NLsym(2)
                logo=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
                logo2=imrotate(logo,180);
            end
        end
        
        if length(logo)>1
            set(ShowTotalScript(NScriptCrecter),'cdata',logo);
            set(ShowLatTrans(NScriptCrecter),'cdata',logo2);
        end
        
        StoreCrecterUsesOfScript(1)=((ceil(Cnum/(hb*ob))-1)*(hb*ob))+1;
        StoreCrecterUsesOfScript(2)=Cnum;

        ScriptStore(Cnum)=nB;
        
        if NScriptCrecter==(hb*ob)
            NScriptCrecter=0;
        end
        NScriptCrecter=NScriptCrecter+1;
        
        if length(ScriptStore)>=(hb*ob)+1
            set(UpButton,'enable','on');
        end
    end

    function ChangeScriptLogo(a,b)
        
        StoreCrecterUsesOfScript(1)=a;
        StoreCrecterUsesOfScript(2)=b;
        
        t=cell2mat(FntNa(3,TextType));
        
        p=1:(hb*ob);
        pt=1;
        for NS=a:b
            nB=ScriptStore(NS);
            
            klk=CurentFont(2,nB,TextType);
            
            if klk<=NES
                logo=getbuttonlogo(CDr,t,nB,[pos4(4),pos4(3)]);
                logo2=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
            elseif klk>NES
                if klk==NLsym(2)
                    logo=getbuttonlogo(CDr,'NLC',1,[pos4(4),pos4(3)]);
                    logo2=getbuttonlogo(CDr,'NLC',2,[pos4(4),pos4(3)]);
                elseif klk>=lLs && klk<=rLs
                    logo=getbuttonlogo(CDr,t,nB,[pos4(4),pos4(3)]);
                    logo2=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
                elseif klk~=NLsym(2)
                    logo=getbuttonlogo(CDr,'LatC',klk,[pos4(4),pos4(3)]);
                    logo2=imrotate(logo,180);
                end
            end
            
            set(ShowTotalScript(p(pt)),'cdata',logo);
            set(ShowLatTrans(p(pt)),'cdata',logo2);
            pt=pt+1;
        end    
    end

    function ApplyEditingInTranslation(TextType,ScriptStore)
        TextStore=CurentFont(1,ScriptStore,TextType);
        ShowTranslation(TextStore);
    end

%    function CurentFont=RecoverFontSettings(TextType,FntM1)
        %If we will use this function, we will remove
        %"CurentFont(TextType,:)=FntM1;" from "RestButton_p" function
%        if TextType==1
%            FntM1=[FntM;FntMS(1,:)];
%            CurentFont(TextType,:)=FntM1(1,:);
%        elseif TextType==2
%        end
%    end
%--------------------------------------


%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    function [Cstor,Cnum,TextStore,NScriptCrecter,StoreCrecterUsesOfScript,FSTS_store,ETB_store,ScriptStore,Cacv]=StartParameter
        Cstor=1;%Last Character "Button" pusing.
        Cnum=0;%Number's Order of Character
        TextStore=[];% Text Store
        NScriptCrecter=1;% Number Of Script Characters

        StoreCrecterUsesOfScript=[1,1,0];
        
        
        ScriptStore=[];
        
        ETB_store=[0,0];%Uses to edit charecter's button value by using
                        %"ShowTotalScript" button. >> ETB_store(1): number
                        %of pushed button.
                        %                          >> ETB_store(2): the
                        %                             new value of that button
                        
        FSTS_store=[0,0];%FSTS_store(1):To determen if change is needed. >> 0=No, 1=Yes
                         %FSTS_store(2):To determen which "ShowTotalScript"
                         %button was pushed.

        for nn=1:length(ACV)
            Cacv(nn)={char(ACV(nn))}; %#ok<AGROW>
        end
        
        SetNewWindowName;
    end
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

end

Contact us