IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Développement OS X Discussion :

Scrap Manager : f_ULL_CBClearScrap


Sujet :

Développement OS X

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2018
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2018
    Messages : 9
    Points : 10
    Points
    10
    Par défaut Scrap Manager : f_ULL_CBClearScrap
    Bonjour

    parce que je trouve qu'on perd beaucoup de temps à adapter les sautes d'humeur d'Apple, au lieu de travailler à
    ses propres développements, je vous livre un 'tit bout de code pour effacer le presse-papiers (procedure f_ULL_CBClearScrap).
    Normalement, ça marche du Mac Plus System 1 à Mojave et autres.

    (si ça intéresse, je livre d'autres bouts)

    G.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    
    { ————————————————————————————————————————————————————————————— }
    {$IF LSM_TARGET_CARBON_MAC64_IPHONE_TVOS_WATCHOS = 1}
    { ------------------------------------------------------------------------- }
    { iOS 2.0+, macOS 10.0+, tvOS 9.0+, watchOS 2.0+ }
    { on SAIT que : h_cfs <> nil }
    {  -> S = '' }
    
    	procedure f_OSX_CFStringToString (h_cfs: CFStringRef; var S: string);
    	{$IF LSM_LINKER_FPC = 0}
    		var
    			B_ok: boolean;
    	{$ENDIF}
    	begin
    	{$IF LSM_LINKER_FPC = 0}
    		B_ok := 
    	{$ENDIF}	CFStringGetPascalString(h_cfs, @S, 256, kCFStringEncodingMacRoman)
    	end;
    
    {$ENDIF}
    { ————————————————————————————————————————————————————————————— }
    {$IF LSM_TARGET_CARBON_MAC64 = 1}
    { ------------------------------------------ }
    
    	function f_CBN64_PasteboardCreate: PasteboardRef;
    		var
    			h_crs: PasteboardRef;
    			L_oss: OSStatus;
    			h_cfs: CFStringRef;
    	begin
    		h_crs := nil;
    		
    	{ - }
    		
    		h_cfs := f_OSX_StringToCFString('com.apple.pasteboard.clipboard');
    		
    		if h_cfs <> nil then
    		begin
    			L_oss := PasteboardCreate(h_cfs, h_crs);
    			
    			if L_oss <> noErr then
    				h_crs := nil;
    			
    			CFRelease(CFTypeRef(h_cfs))
    		end;
    		
    	{ - }
    		
    		f_CBN64_PasteboardCreate := h_crs
    	end;
    
    {$ENDIF}
    { ————————————————————————————————————————————————————————————— }
    {$IF LSM_TARGET_68K_PPC = 1}
    { ---------------------------------- }
    
    	procedure f_68K_PPC_PasteboardClear;
    	{$IF LSM_LINKER_FPC = 0}
    		var
    			L_oss: OSStatus;
    	{$ENDIF}
    	begin
    	{$IF LSM_LINKER_FPC = 0}
    		L_oss := 
    	{$ENDIF}	 ZeroScrap
    	end;
    
    {$ENDIF}
    { ————————————————————————————————————————————————————————————— }
    {$IF LSM_TARGET_CARBON = 1}
    { --------------------------------- }
    
    	procedure f_CARBON_PasteboardClear;
    	{$IF LSM_LINKER_FPC = 0}
    		var
    			L_oss: OSStatus;
    	{$ENDIF}
    	begin
    	{$IF LSM_LINKER_FPC = 0}
    		L_oss := 
    	{$ENDIF}	 ClearCurrentScrap		{ DEPRECATED 10.0_10.5 }
    	end;
    
    {$ENDIF}
    { ————————————————————————————————————————————————————————————— }
    
        procedure f_CBN64_PasteboardClear;
    		var
    			h_crs: PasteboardRef;
    		{$IF LSM_LINKER_FPC = 0}
    			L_oss: OSStatus;
    		{$ENDIF}
    	begin
    		h_crs := f_CBN64_PasteboardCreate;
    		
    		if h_crs <> nil then
    		begin
    		{$IF LSM_LINKER_FPC = 0}
    			L_oss := 
    		{$ENDIF}	 PasteboardClear(h_crs);
    			
    			CFRelease(CFTypeRef(h_crs))
    		end
    	end;
    
    { ————————————————————————————————————————————————————————————— }
    
        procedure f_ULL_CBClearScrap;
        begin
    
    	{$IF LSM_TARGET_68K_PPC = 1}
    
    		f_68K_PPC_PasteboardClear;
    
    	{$ENDIF}
    	(****************************************************************************************)
    	{$IF LSM_TARGET_CARBON = 1}
    
    		if xx_ULL.ull_sys >= $1030 then
    			f_CBN64_PasteboardClear
    		else
    			f_CARBON_PasteboardClear;
    
    	{$ENDIF}
    	(****************************************************************************************)
    	{$IF LSM_TARGET_MAC64 = 1}		{ => xx_ULL.ull_sys >= $1060 }
    
    		f_CBN64_PasteboardClear;
    
    	{$ENDIF}
    	(****************************************************************************************)
    	{$IF LSM_TARGET_IPHONE_TVOS_WATCHOS = 1}
    
    								{ _zibuibui_iPhone_ }
    								{ _zibuibui_iTVOS_ }
    								{ _zibuibui_iWatch_ }
    
    	{$ENDIF}
    	(****************************************************************************************)
    	{$IF LSM_TARGET_WIN32_WIN64_ANDROID = 1}
    
    								{ _zibuibui_win32_ }
    								{ _zibuibui_win64_ }
    								{ _zibuibui_android_ }
    	{$ENDIF}
    	(****************************************************************************************)
    
    		xx_ULL.ull_ppp_ref := nil;
    		xx_ULL.ull_ppp_nat := 0;
    		xx_ULL.ull_ppp_whn := 0
    	end;
    
    { ————————————————————————————————————————————————————————————— }

  2. #2
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Octobre 2018
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2018
    Messages : 9
    Points : 10
    Points
    10
    Par défaut
    Rebonjour

    petit correctif pour ne pas planter Mojave : ne pas CFRelease(CFTypeRef(h_crs))
    il faut au contraire le mettre en variable globale et ne pas y toucher
    N'aime pas ça, Mojave, sinon…

Discussions similaires

  1. Réponses: 3
    Dernier message: 18/02/2004, 17h53
  2. Problème Window manager sous Slackware 9.1
    Par Riko dans le forum Applications et environnements graphiques
    Réponses: 4
    Dernier message: 30/01/2004, 07h38
  3. Problème dans analisys Manager
    Par ien_ien23 dans le forum MS SQL Server
    Réponses: 7
    Dernier message: 11/07/2003, 14h38
  4. traduction du terme "managed"
    Par sarasvati dans le forum Langages de programmation
    Réponses: 11
    Dernier message: 14/05/2003, 23h01
  5. A propos des 'File management Functions' de Windows
    Par znaidi dans le forum Windows
    Réponses: 3
    Dernier message: 01/04/2003, 16h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo