WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: fltk mc file manager like  (Read 3023 times)

Offline Patatalo

  • Newbie
  • *
  • Posts: 12
fltk mc file manager like
« on: October 08, 2014, 06:30:41 AM »
hello,

fluid source of a file manager project. Not usable at this point, i post to have help on links following option. since ftw glibc have no user param, i don't want to use them with a global variable...

when following links option is enabled, we can have a recurse in path:
you work on /home/root/dirA/dirB and following a link on dirB -> /home/root/dirA ?

how treats that ?
* the first idear is to make an array of ino_t for each device and for each ulisted directories. When a link is followed, we can see on these arrays if the directory was already listed.
* second idear is to make an array of path and check it for the followed links.

someone have a better idear ?

in attachement the source but don't use it without debug options DBG_RM and DBG_FSO. Then the prog don't remove nothing on your disks, ...

Oups, here a copy of .mimes file:
Code: [Select]
; %d:repertoire
; %f:fichier

Directory=
Terminal=aterm
Compresser tbz2=tar -cj -f %f.tbz2 %f
Compresser tgz=tar -cz -f %f.tgz %f

Fichier=
Edition Texte=editor %d/%f

Executable
Executer=%d/%f
Shell=aterm -e %d/%f

Image=.jpg .jpeg .png .bm .bmp .gif .xpm .xbm .pgm .pbm .ppm
Icon=image-x-generic
Voir=opera %d/%f

Video avi=.avi .divx
Icon=video-x-generic
Regarder=mplayer %d/%f

Musique mp3=.mp3 .wav .mpc
Icon=audio-x-generic
Ecouter=mplayer %d/%f

Playlist=.m3u
Icon=text-x-generic
Ecouter=mplayer -playlist %d/%f

Image cd/dvd-rom=.iso
Monter=disk m %d/%f

Fichier Squashfs=.sqfs .tcz
Monter=disk m %d/%f

Fichier pdf=.pdf
Ouvrir=xpdf %d/%f

Fichier Htm=.html .htm
Vue simple=htmview %d/%f

Fichier Htm compile=.mht
Ouvrir=opera %d/%f

Fichier Fluid=.fl
Icon=text-x-generic
Compiler=fluid -c %d/%f
Ouvrir=fluid %d/%f

Fichier Source=.c .cpp .cxx .h .asm
Icon=text-x-generic

Archive tgz=.tgz .tar.gz
Icon=archive-x-generic
Decompresser=tar -zxf %d/%f

Archive tbz2=.tbz2 .tar.bz2
Icon=archive-x-generic
Decompresser=tar -jxf %d/%f

Archive zip=.zip
Icon=archive-x-generic
Decompresser=unzip -o -d %d %d/%f


@++

              [EDIT]: Added code tags.  Rich

added icons & .mimes on attachment.
added box message for unimplemented copy/cut.
added forgotten #if DBG_FSO on UIFsOp !!! previous version can modify files on the disk.

// Le 10/10/2014
// * UIFind::findIn() - correction memmem() comparaison sur la taille de la lecture
//    au lieu de la taille du buffer
// * suppression de UIRemove -> UIFsOp(FSO_REMOVE)
// * Ajout de UIReplace, fl_choice() n'ayant pas assez de boutons.
// * ajout license GPL

// Le 11/10/2014
// * UIExplorer::cmd() - correction rapport d'echec.
// * File_Browser::match2() - corrections
// * File_Browser::find2() - corrections
// * File_Browser::monitor() - corrections
// * UIFind::findIn() - rejete les fichiers de taille < ssz
// * TFile - add uid & gid
« Last Edit: October 11, 2014, 11:18:40 PM by Patatalo »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: fltk mc file manager like
« Reply #1 on: October 08, 2014, 07:15:13 AM »
Hi Patatalo
I know MC handles so you might want to check the source code to see how they do it.

Offline Patatalo

  • Newbie
  • *
  • Posts: 12
Re: fltk mc file manager like
« Reply #2 on: October 08, 2014, 02:44:12 PM »
thanks Rich, i have found nothing about "MC handles" (perhaps something like pointers on TFile), but i have find the sources of MC.

@++

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: fltk mc file manager like
« Reply #3 on: October 08, 2014, 04:48:13 PM »
Hi Patatalo
Sorry, I know Midnight Commander can do recursive directories, so maybe look at the source code for that.

Offline Patatalo

  • Newbie
  • *
  • Posts: 12
Re: fltk mc file manager like update
« Reply #4 on: October 12, 2014, 05:09:57 PM »
Thanks for your help Rich, i have do my first idear, i record symlinks i have followed and don't process them more time.

// Le 12/10/2014
// * foreach - l'option suivre liens, enregistre ceux qui pointent vers des repertoires
//    et ne seront traverses qu'une fois. Applique le pattern aux fichiers et
//    repertoires avec l'option.

// * UIFsOp:: - rejete la copie quand le repertoire source est ou devient
//    identique au repertoire destination. Changement de class de fiDst
//    Fl_File_Input -> Fl_Output tant que je ne vois pas encore comment
//    traiter correctement le changement ou renomage de destination.

// * File_Browser::monitor() - correction de l'evenement IN_MOVED_TO qui semble
//    devoir etre traite plutot comme un IN_MODIFY que comme un IN_CREATE

// Le 13/10/2014
// * UIExplorer - ajout des callbacks du menu fichier.

// * TPath     - gestion des tailles.

// * foreach - gestion des tailles.
//         -   Possibilite de stopper le traitement.
//         -   Suppression du fl_message au profit d'un appel client en cas de manque
//          de memoire.

// * UIFind  -   possibilite d'annuler le traitement.

// * File_Browser::monitor() - IN_MOVED_TO se comporte comme un IN_MODIFY si le nom est
//          trouve dans la liste sinon comme un IN_CREATE.


// Le 14/10/2014
// * UIFsOp  - gestion des tailles et annulation.

// * UIFiles - gestion des tailles.

// * TAction::exec() - gestion des tailles.

// * UIExplorer - handle() - correction maj src_/dst_ avec evenement FL_PUSH
//           - ajout callback fiN
         
// * foreach  - fonctionnement de l'option FE_DPTRN changée. Quand l'option
//          est active, les repertoires sont tous listés mais le callback
//          n'est appelé que si le pattern correspond. Ce fonctionnement
//          pose un probleme en cas de double passe (copie, deplacement). Un
//          fichier ne peut pas etre copié si son arborescence n'est pas cree.
//          En consequence, la premiere passe a toujours son callback et seule
//          la deuxieme passe est omise.


!!! this version has no debug options but is a beta version. I've tried it a little and seems ok but be careful

ok, the update will be more spaced now. Perhaps if i find a big bug or make an important thing.

On the remove box: Enter said ok, Escape said no. Do not valid a button with enter even if it have the focus, use space.

in Fl_Browser:
ctrl + a : select all
ctrl + i : invert selection
ctrl + c : copy
ctrl + x : move
ctrl + enter : select/unselect

in UIExplorer:
tab bascule src_/dst_
ctrl + s : search
ctrl + e : edit
ctrl + n : new
ctrl + h : show/hide hidden files.
ctrl + d : show/hide directories
ctrl + f : show/hide files.

A very small update: you can open UIFind results with editor with a double click on the browser. I find this very useful...

// UIFsOp - ajout d'un compteur, l'appel a Fl::wait() ne se fait qu'une fois sur 16, on gagne grandement en vitesse tout en gardant une reponse d'annulation rapide.

UIFiles : correction mise a jour du browser (pattern non nul -> nul).

flmc6.fl inclu un debut de codage de copie asynchrone (aio). A la compilation, j'ai remarqué que cela necessitait une librairie en plus (libaio). Je laisse donc tomber pour envisager plutôt l'utilisation de pthread directement.

// Le 22/10/2014
// * UIFsOp - Ajout d'un compteur pour limiter les appels Fl::wait()

// * UIFiles - correction maj pattern non vide -> vide.
//         -   handle() les double clicks sur les scrollbars sont
//          renvoyées vers elles.

// * TAction - Remplacement double fork() par gestionnaire de signaux.

// * UIExplorer - Remplacement system() par TAction. Il est maintenant
//    possible d'avoir la même fonctionnalité que pour le fichier .mime
//    editor %f ouvrira le fichier de src_ selectionné.

// Le 24/10/2014
// * UIExplorer - Separateur de redimension des deux browsers.
//           - historique des commandes. (!!! pas de limite) (ou presque, le template est limité)

// * template de la classe conteneur.

// * UIFiles - tentative de gestion page up/page down pour un suivi de selection. Ca fonctionne quand on va vers le haut
//          mais pas vers le bas ???

shell history: CTRL+UP/CTRL+DOWN
« Last Edit: October 24, 2014, 09:44:53 AM by Patatalo »